[02/03] looping through checkboxes in a panel(s)
My usercontrol is going to have several panel controls on it. Within each panel there will be a checkboxlist and possibly a textbox. Depending on the value passed to the usercontrol a particular panel will be visible and the other panels won't be visible.
So, without writing a massive amount of IF statements how can I capture the selected items in the checkboxlist of the visible panel?
Re: [02/03] looping through checkboxes in a panel(s)
is there a more streamlined way of doing this?
hManualTokens is a hashtable
Code:
Dim i As Integer
For Each ctrl As Control In Page.Controls
If TypeOf ctrl Is Panel Then
If ctrl.Visible = True Then
Dim iControlNumber As Integer = Right(ctrl.ID, 3)
If iControlNumber = "132" Then
For i = 0 To cb132.Items.Count - 1
If cb132.Items(i).Selected Then
hManualTokens.Add(cb132.Items(i).Value, "X")
Else
hManualTokens.Add(cb132.Items(i).Value, "_")
End If
Next i
ElseIf iControlNumber = "142" Then
For i = 0 To cb142.Items.Count - 1
If cb142.Items(i).Selected Then
hManualTokens.Add(cb142.Items(i).Value, "X")
Else
hManualTokens.Add(cb142.Items(i).Value, "_")
End If
Next i
End If
End If
End If
Next
Re: [02/03] looping through checkboxes in a panel(s)
Don't the lists have a .SelectedItems array?