Hi,
I have a usercontrol with a number of textboxes on it.
Does anyone have any code that will loop through all the controls find a textbox and then set the readonly property to true.
I have tried this :
If TypeOf ctlForm Is HtmlForm Then
For Each ctlContent As Control In ctlForm.Controls
If TypeOf ctlContent Is ContentPlaceHolder Then
For Each ctlChild As Control In ctlContent.Controls
'Hide All textbox
If TypeOf ctlChild Is textbox Then
CType(ctlChild, textbox).readonly = true
End If
Next
End If
Next
End If
But obviously this doesnot work.
Thanks
I have a usercontrol with a number of textboxes on it.
Does anyone have any code that will loop through all the controls find a textbox and then set the readonly property to true.
I have tried this :
If TypeOf ctlForm Is HtmlForm Then
For Each ctlContent As Control In ctlForm.Controls
If TypeOf ctlContent Is ContentPlaceHolder Then
For Each ctlChild As Control In ctlContent.Controls
'Hide All textbox
If TypeOf ctlChild Is textbox Then
CType(ctlChild, textbox).readonly = true
End If
Next
End If
Next
End If
But obviously this doesnot work.
Thanks