»Dotnet Ads
»Message Boards
Message Boards
Dotnet Books
»Member Details
Register
Login
LogOut
Submit Code
Submit Jobs
Submit Projects
»Competition
Community
Winners
Prizes
Write For Us
Members
»Other Resources
Links
Dotnet Resources
|
Clearing all field in a web formThis code shows you how to clear all field in a web form. It is very usefull in a page where there are a lot of text fields , check boxes which needs to be cleared with the press of a button
Private Sub ClearForm()
'Reset TextBoxes on form
Dim ctl As Control
For Each ctl In Me.FindControl("Form1").Controls
If (Not ctl Is System.DBNull.Value) Then
If (ctl.GetType.ToString().ToLower().IndexOf("textbox") > 0) Then
CType(ctl, TextBox).Text = String.Empty
End If
End If
Next
'Reset CheckBoxList
Dim i As Integer
While i < Me.chkType.Items.Count
Me.chkType.Items(i).Selected = False
i += 1
End While
End Sub
|
|