How to check that at least one item is selected

3 posts, 0 answers
  1. Jesper
    Jesper avatar
    15 posts
    Member since:
    Aug 2011

    Posted 27 Oct 2011 Link to this post

    Hi,
    how to check that at least one item is selected in a RadComboBox? My RadComboBox allows just single selection and I want to check that user has selected one item which is needed for next/related user input control (RadListBox) will be loaded with data (from code behind). Meaning I will check that at least one item is selected from code behind method RadComboBox_SelectedIndexChanged and if one item is checked load data into next/related RadListBox.

    Why isn't there a method RadComboBox.SelectedItems.Count as there is for example RadListBox?

    I have EmptyMessage set to '--- Select ---' in RadComboBox. Can I use this in some way?

    Rgds,
    Jesper 
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 27 Oct 2011 Link to this post

    Hello Jesper,

    You can try the following for getting the count of selected items.

    C#:
      protected void RadComboBox1_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
    {
     int count = RadComboBox1.SelectedValue.Length;
    }

    Thanks,
    Princy.
  3. Jesper
    Jesper avatar
    15 posts
    Member since:
    Aug 2011

    Posted 27 Oct 2011 Link to this post

    Hi Princy,
    did it... Thx

    if (RadComboBox1.SelectedValue.Length > 0)
    {
    ...
    }

    Regards,
    Jesper
Back to Top