NoSelection problem

2 posts, 0 answers
  1. Nejchy
    Nejchy avatar
    1 posts
    Member since:
    Nov 2009

    Posted 08 Jan 2013 Link to this post

    I have a combobox which is bound to a list of DictionaryEntries. And I would like that when the form is shown no item is selected (SelectedItem = null).

    Test program
    public partial class Form1 : Form
        public Form1()
          Print("Before show");
        public void Bind(
          List<DictionaryEntry> p_List)
          radDropDownList1.ValueMember = "Key";
          radDropDownList1.DisplayMember = "Value";
          radDropDownList1.DataSource = p_List;
          radDropDownList1.SelectedIndex = -1;
          radDropDownList1.SelectedItem = null;
          radDropDownList1.SelectedValue = null;
        private List<DictionaryEntry> GetList()
          return new List<DictionaryEntry>
                     new DictionaryEntry(0, "Entry 0"),
                     new DictionaryEntry(1, "Entry 1")
        private void button1_Click(object sender, EventArgs e)
        private void Print(string p_Message)
          richTextBox1.AppendText(String.Format("{2}\nSelectedIndex = {0}\nSelectedValue = {1}\n\n",
                                            radDropDownList1.SelectedIndex, radDropDownList1.SelectedValue, p_Message));
        private void Form1_Shown(object sender, EventArgs e)
        private void button2_Click(object sender, EventArgs e)
          Print("Print state");

    The problem is that when the form is shown DropDownList automatically selects first element in the list (SelectedIndex, SelectedItem,.. are updated but Text is not).
    If I rebind after the form is shown DropDownList works correctly.

    Can I bind a list in a way that Form.Show will not select the first element in the list (SelectedItem = null)?
  2. Peter
    Peter avatar
    1160 posts

    Posted 10 Jan 2013 Link to this post

    Hello Nejchy,

    We are aware of this issue and it has been logged to our Public Issue Tracking System. It will be addressed in our next internal build.

    As a workaround you can set the selected index this way:
    this.radDropDownList1.SelectedIndex = -1;

    Thank you for your time and cooperation.

    All the best,
    the Telerik team
    Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
Back to Top