How can i do to clear all the textbox using controls?

  • Thread starter Thread starter Ricardo Corsi P. Cesar
  • Start date Start date
R

Ricardo Corsi P. Cesar

I have many textbox in my webform, but i want clear all of them with on
single step.

Someone have the code ?



Thks
 
This sample code should do what you're looking for:

Sub ClearTextBoxes()
Dim myForm As Control = Page.FindControl("form1")
Dim ctl As Control
For Each ctl In myForm.Controls
If ctl.GetType().ToString().Equals("System.Web.UI.WebControls.TextBox")
Then
CType(ctl, TextBox).Text = ""
End If
Next ctl
End Sub


Hope this helps,
Chris Moore [MSFT]


--------------------
 
Back
Top