Karl Moore provides the following code to clear a windows form. I am having trouble adapting it to ASP.NET.

Any help would be appreciated.

Karl Moore's code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ResetForm(Me)
End Sub

Public Sub ResetForm(ByVal FormToReset As Form)
' Resets the main data entry controls on the passed FormToReset
Dim objControl As Control
' Loop around every control on the form and run the reset method
For Each objControl In FormToReset.Controls
ResetControl(objControl)
Next
End Sub

Public Sub ResetControl(ByVal ControlToReset As Control)
' Resets the core control, then loops and
' resets any sub controls, such as Tab pages
Dim intCount As Integer
ClearControl(ControlToReset)
If ControlToReset.Controls.Count > 0 Then
For intCount = 1 To ControlToReset.Controls.Count
ResetControl(ControlToReset.Controls(intCount - 1))
Next
End If
End Sub

Public Sub ClearControl(ByVal ControlToClear As Control)
' Clears the value of a particular control -
' you may wish to extend this to suit your exact needs
If InStr(ControlToClear.Tag, "skip", CompareMethod.Text) = 0 Then
If TypeOf (ControlToClear) Is System.Windows.Forms.TextBox Then
ControlToClear.Text = "" ' Clear TextBox
ElseIf TypeOf (ControlToClear) Is System.Windows.Forms.CheckBox Then
Dim objCheckBox As System.Windows.Forms.CheckBox = ControlToClear
objCheckBox.Checked = False ' Uncheck CheckBox
ElseIf TypeOf (ControlToClear) Is System.Windows.Forms.ComboBox Then
Dim objComboBox As System.Windows.Forms.ComboBox = ControlToClear
objComboBox.SelectedIndex = -1 ' Deselect any ComboBox entry
End If
End If
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Select sample item in combo box
ComboBox1.SelectedIndex = 1
End Sub