Remove blank row in RadCombobox

4 posts, 0 answers
  1. John
    John avatar
    34 posts
    Member since:
    Oct 2010

    Posted 23 Feb 2011 Link to this post

    Greetings,
    After binding the datasource to a RadCombobox, it appears to have a blank row at index 0.  Is there a way to remove it by default?

    Thanks
  2. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 28 Feb 2011 Link to this post

    Hello John,

    Thank you for contacting us.

    Could you please send us your implementation of the ComboBox, are you using custom ItemTemplate? If you could reproduce this issue in a sample project and send it to us it will be very helpful for tracking down the source of the issue.

    Looking forward to your reply.

    All the best,
    Konstantina
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. DevCraft banner
  4. John
    John avatar
    34 posts
    Member since:
    Oct 2010

    Posted 02 Mar 2011 Link to this post

    I am not using customTemplate.  It is just a plain simple sample:

    <telerik:RadComboBox HorizontalAlignment="Left" Margin="132,48,0,0"
                         Name="radComboBox1"
                         VerticalAlignment="Top" Width="250" />

    In my .cs file, I have:
    public partial class MainPage : UserControl
    {
        public static List<Quality> QualityList = new List<Quality>();
     
        public MainPage()
        {
            InitializeComponent();
     
            QualityList.Add(new Quality() { qual_id = 1, qual_desc = "FULL" });
            QualityList.Add(new Quality() { qual_id = 2, qual_desc = "PARTIAL" });
            QualityList.Add(new Quality() { qual_id = 3, qual_desc = "REQUIRED" });
     
            radComboBox1.SelectedValuePath = "qual_id";
            radComboBox1.DisplayMemberPath = "qual_desc";
            radComboBox1.ItemsSource = QualityList;
     
        }
    }
     
    public class Quality
    {
        public int qual_id {get; set;}
        public string qual_desc { get; set; }
    }

    When first run, the combobox will get the first index, and should show FULL in the display.  However, it doesn't show anything.
    Until, I add this line:
    radComboBox1.SelectedIndex = 0;
    then it will show.

    After binding the source, I want it select the first value, instead of the empty row.

    Is there a way to force it to select the first index right away?
  5. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 03 Mar 2011 Link to this post

    Hello John,

    Yes, to make it select the first index, you will have to set the SelectedIndex property, as you mentioned. By default the ComboBox doesn't select the first item. You can read more about the selection in ComboBox in this help article.

    Please let us know if you have further questions.

    All the best,
    Konstantina
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Back to Top