Hi I have wrote a simple function to clear all fields, in essence to reset the form, as below
For Each ctl As Control In parent.Controls
If ctl.Controls.Count > 0 Then
ResetControlValues(ctl)
Else
Select Case (ctl.GetType().ToString())
Case "System.Web.UI.WebControls.TextBox"
CType(ctl, TextBox).Text = ""
Case "System.Web.UI.WebControls.checkboxlist"
For Each li As ListItem In CType(ctl, CheckBoxList).Items
li.Selected = False
Next
End Select
End If
Next ctl
The problem is if there is a checkboxlist control on the form it doesn't actually include it as being a control, can anyone advise why?
Thanks
For Each ctl As Control In parent.Controls
If ctl.Controls.Count > 0 Then
ResetControlValues(ctl)
Else
Select Case (ctl.GetType().ToString())
Case "System.Web.UI.WebControls.TextBox"
CType(ctl, TextBox).Text = ""
Case "System.Web.UI.WebControls.checkboxlist"
For Each li As ListItem In CType(ctl, CheckBoxList).Items
li.Selected = False
Next
End Select
End If
Next ctl
The problem is if there is a checkboxlist control on the form it doesn't actually include it as being a control, can anyone advise why?
Thanks