views:

20

answers:

1

so im dynamically populating a checkbox list. I have confirmed that my text and values are correct for each checkbox but when I check a few and click my event button when I loop through the items they are all set to select=false...

    Dim resource As ListItem
    Dim SelectedHashTable As New Hashtable
    For Each resource In chkResources.Items
        If resource.Selected = True Then
            SelectedHashTable.Add(resource.Text, resource.Value)
        End If
    Next

set checkpoint at line 5 to view contents of hash table but it is never triggered. Even when I check all boxes. Anyone any idea?

+1  A: 

Where are you dynamically populating the checkboxlist? If it's any time after the OnInit event, then the control's viewstate is not getting saved properly and your selections will be overridden on every postback. Try dynamically populating your list in the OnInit handler.

Steve Danner
thanks I totally forgot about that issue! put it in a isPostBack check and all is well :D
iamjonesy