'clear textbox controls on a regular web form

 '---use this for a regular web form
Dim ctrl As Control
For Each ctrl In Page.FindControl("Form1").Controls
             If ctrl.GetType() Is GetType(TextBox) Then
                 CType(ctrl, TextBox).Text = ""
             End If
Next

 

 

C#

 //form2 is the name of the html form. Look at source view.
foreach (Control ctrl in Page.FindControl("Form2").Controls)
{
if (ctrl is TextBox)

((TextBox)ctrl).Text = "";

}