This is a migrated thread and some comments may be shown as answers.

radlistbox of checkboxes

1 Answer 58 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Tash
Top achievements
Rank 1
Tash asked on 16 May 2012, 07:36 PM
I have a radlistbox of checkboxes. Each checkbox corresponds to hidden panels that I want to become visable.

So for example the checkboxes are

New York        London        Washington

when someone clicks on New York I want a panel to open up. If someone unchecks that checkbox then I want the panel to disappear.

How do I know which items in the panel is checked?

Any help would be appreciated.

Thanks

1 Answer, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 18 May 2012, 09:59 PM
Tashfin:

This code fires on a "Get Checked Items" button-click event and writes all of the checked items to a label on the form:
private static void ShowCheckedItems(RadListBox listBox, Label label)
{
    StringBuilder sb = new StringBuilder();
    IList<RadListBoxItem> collection = listBox.CheckedItems;
    foreach (RadListBoxItem item in collection)
    {
        sb.Append(item.Value + "<br />");
    }
 
    label.Text = sb.ToString();
 
}
 
protected void Button1_Click(object sender, EventArgs e)
{
    ShowCheckedItems(RadListBox1, itemsClientSide);
}

I hope this helps!
Tags
ListBox
Asked by
Tash
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Share this question
or