Oh, after a while again I decided to start writing on this blog.
Any way, I thing sometimes it happens that you need to show some choices to your users then ask them to select any many as they want. So as you may know the best choice is CheckListBox. So after Binding it or adding your items into it you may want to get a list of SelectedItems over the checklistbox. So you have to iterate over your items then check whether if the item is checked or not like this:
foreach (ListItem item in CheckBoxList1.Items)
{
if(item.Selected)
{
Response.Write("<h3>" + item.Text + "</h3>");
}
}
Do not forget comments.
Saturday, May 12, 2007
Getting All Selected Items of CheckListBox
Subscribe to:
Post Comments (Atom)
9 comments:
Thanks buddy !!!!!!!!!!!
it does not work....
ListItem is not an object ;(
fix your script ;)
Great job; just what I was looking for!
Works just great!!! Thanks!!!
its not working , i already try that before you and its a common logic to get the items but its not.
Great. Thanks a lot...
work fine man. thanks
thanks mate!!!!
really helps me :D
thanks bro I really need this
Post a Comment