[RESOLVED] Multiple selection list boxes
I am trying to get data from a few list boxes, so I set up a stringbuilder to append the value selected, but how would that work with boxes that I set to "multiple selection"?
Also, what is a more efficient way to reset a form other than settings everything to "" when the button is clicked?
EDIT: Wow, remembered the onReset="return clearFields();.
Re: Multiple selection list boxes
Loop through the .Items of the listbox and check for the .Selected property.
vb Code:
For Each li As ListItem in myListBox1.Items
If li.Selected = True Then
'Add to stringbuilder
End If
Next
Re: Multiple selection list boxes
Thanks.
So this is alright then?
vb Code:
For Each li As ListItem In lstOrgMain.Items
If li.Selected = True Then
strBody.Append("Main Campus Organizations: " & li.Selected & "")
End If
Next
Re: Multiple selection list boxes
Eh I guess that doesn't work... What did I do wrong? I get this as a result:
Quote:
Main Campus Organizations: TrueMonroe Campus Organizations: TrueMonroe Campus Organizations: TrueIntramural Sports: TrueIntramural Sports: TrueIntramural Sports: TrueIntramural Sports: TrueIntercollegiate Sports: TrueIntercollegiate Sports: TrueIntercollegiate Sports: TrueSemester
EDIT: Duh, should be "value" and not "selected".
Re: Multiple selection list boxes
Does that edit you made mean that you solved the problem?
Re: Multiple selection list boxes
Yep sorry, all is well with this issue now.