ComboBox not sorting correctly

2 posts, 0 answers
  1. Bill Holze
    Bill Holze avatar
    1 posts
    Member since:
    Mar 2005

    Posted 14 Jul 2011 Link to this post

    I have a combobox that has numbers and alpha in the same list.  I need ALL to be the first choice but when I put ascending as a sort option the numbers are above the words.  Example below:

    3rd Party
    2 Board
    ALL
    Blade
    Cards
    Video

    Is there a way to get ALL to the top so it looks like this. (See Below)  The choices are being filled from a datasource except for ALL which is being added by using the AppendDataBoundItems= True and Text = ALL
    ALL
    3rd Party
    2 Board
    Blade
    Cards
    Video

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 14 Jul 2011 Link to this post

    Hello Bill,

    Try the following code snippet in DataBound event to add default item in RadComboBox. Here is the sample code that I tried which worked as expected.

    C#:
    protected void RadComboBox1_DataBound(object sender, EventArgs e)
    {
        var combo = (RadComboBox)sender;
        combo.Items.Insert(0, new RadComboBoxItem("All","All" ));
    }

    Also check the following help documentation which explains the same.
    Insert a default item when databinding RadComboBox.

    Thanks,
    Princy.
Back to Top