Discovered today that the databound checkboxlist items' SELECTED property doesn't reflect what's in the VALUE property. The following code on the checkboxlist databound event hanlder cleared things up for me:
Protected Sub cblRoles_DataBound(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles cblRoles.DataBound
Dim loItem As ListItem = Nothing
For Each loItem In cblRoles.Items
loItem.Selected = loItem.Value
Next
End Sub
Now, when the form loads, the items with Value=True now display with the checkbox selected. Whew!
Blog Archive
Wednesday, February 28, 2007
Databound checkboxlist aggravation
Posted by Chuck Spohr at 11:37 AM 1 comments
Labels: checkboxlist checkbox listitem databound selected value property .net 2.0
Subscribe to:
Posts (Atom)
About Me
- Chuck Spohr
- Principal Partner at NetPositive, Inc., St. Louis, MO.