Author: afache | Posted on: 12/10/2009 10:16:45 AM | Views : 256

Hi,
  I have a clear button in my asp.net page to clear the controls on the page. The way I am clearing the controls in my code behind is through the loop below. Is this efficient or is it better to have controls cleared one by one (meaning write more code course)?
  For Each ctrl As Control In UpdatePanelAll.Controls(0).Controls
            If TypeOf ctrl Is TextBox Then
                CType(ctrl, TextBox).Text = String.Empty
            ElseIf TypeOf ctrl Is DropDownList Then
                CType(ctrl, DropDownList).SelectedValue = "-1"
            ElseIf TypeO ...

Go to the complete details ...