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

Remove blank row in RadCombobox

3 Answers 145 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 23 Feb 2011, 08:31 PM
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

3 Answers, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 28 Feb 2011, 12:21 PM
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!
0
John
Top achievements
Rank 1
answered on 02 Mar 2011, 11:53 PM
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?
0
Konstantina
Telerik team
answered on 03 Mar 2011, 12:54 PM
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!
Tags
ComboBox
Asked by
John
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
John
Top achievements
Rank 1
Share this question
or