Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top