C
Craig G
i have the routine setup as below. the ctlCollection is populated with Page.Controls. but it only ever brings back 3 controls even though there is more than this on the page
the control types it returns are
1 x "System.Web.UI.ResourceBasedLiteralControl"
1 x "System.Web.UI.HtmlControls.HtmlForm"
1 x "System.Web.UI.LiteralControl"
where am i going wrong?
Cheers,
Craig
Private Sub SetBackgroundColour(ByVal ctlCollection As ControlCollection)
Dim ctl As Control
Try
For Each ctl In ctlCollection
If ctl.GetType.ToString = "Textbox" Then
If CType(ctl, TextBox).Enabled = False Then
CType(ctl, TextBox).BackColor = Color.Transparent
Else
CType(ctl, TextBox).BackColor = Color.LightGoldenrodYellow
End If
End If
If ctl.GetType.ToString = "DropDownList" Then
If CType(ctl, DropDownList).Enabled = False Then
CType(ctl, DropDownList).BackColor = Color.Transparent
Else
CType(ctl, DropDownList).BackColor = Color.LightGoldenrodYellow
End If
End If
Next
end sub
the control types it returns are
1 x "System.Web.UI.ResourceBasedLiteralControl"
1 x "System.Web.UI.HtmlControls.HtmlForm"
1 x "System.Web.UI.LiteralControl"
where am i going wrong?
Cheers,
Craig
Private Sub SetBackgroundColour(ByVal ctlCollection As ControlCollection)
Dim ctl As Control
Try
For Each ctl In ctlCollection
If ctl.GetType.ToString = "Textbox" Then
If CType(ctl, TextBox).Enabled = False Then
CType(ctl, TextBox).BackColor = Color.Transparent
Else
CType(ctl, TextBox).BackColor = Color.LightGoldenrodYellow
End If
End If
If ctl.GetType.ToString = "DropDownList" Then
If CType(ctl, DropDownList).Enabled = False Then
CType(ctl, DropDownList).BackColor = Color.Transparent
Else
CType(ctl, DropDownList).BackColor = Color.LightGoldenrodYellow
End If
End If
Next
end sub