CLEAR FORM ELEMENTS/loop through page controls
Handy routine for clearing out all of your textbuttons or making all of your panels visible
Sub resetBtn_Click(Sender As Object, E As EventArgs)
Dim myForm As Control = Page.FindControl("myform") << put in name of your form on your page
Dim ctl As Control
Dim ctl As Control
For Each ctl In myForm.Controls'Clears Textbox Types
If ctl.GetType().ToString().Equals("System.Web.UI.WebControls.TextBox") ThenCType(ctl, TextBox).Text = ""
End IfNext ctl
End Sub
Comments