radlistbox of checkboxes

2 posts, 0 answers
  1. Tash
    Tash avatar
    15 posts
    Member since:
    Jul 2012

    Posted 16 May 2012 Link to this post

    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
  2. jumpstart
    jumpstart avatar
    479 posts
    Member since:
    Nov 2011

    Posted 18 May 2012 Link to this post

    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!
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top