DropDownList with datasource, not working as expected

2 posts, 0 answers
  1. Robert
    Robert avatar
    3 posts
    Member since:
    May 2015

    Posted 07 Jun 2015 Link to this post

    Hello,

     

    I try to use DropDownList with datasource, but is not working as expected.

    When I Clear() the BindingSource, the RAD component still have "Text" with last item displayed which is abnormal.

    Please see the code, the normal windows ComboBox works as expected.

     

    Any fixes?

    public partial class Form1 : Form
    {
        List<string> list = new List<string>();
        BindingSource bsource = new BindingSource();
     
        public Form1()
        {
            InitializeComponent();
     
            bsource.DataSource = list;
     
        }
     
        private void Form1_Load(object sender, EventArgs e)
        {
             
     
            //Set list dataSource
             
            comboBox1.DataSource = bsource;
            radDropDownList1.DataSource = bsource;
     
            //Now add an element via Binding object
            bsource.Add("One");
            bsource.Add("Two");
        }
     
        private void button1_Click(object sender, EventArgs e)
        {
            bsource.Add("Three");
        }
     
        private void button2_Click(object sender, EventArgs e)
        {
            bsource.Clear();
        }
    }
  2. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 08 Jun 2015 Link to this post

    Hi Robert,

    Thank you for writing.

    I have logged this issue in our Feedback Portal. You can track the item for status changes and add your vote for it here.

    To workaround the issue you can manually clear the text:
    private void radButton2_Click(object sender, EventArgs e)
    {
        bsource.Clear();
        radDropDownList1.Text = "";
    }

    Your Telerik Points have been updated for this report.

    Should you have any other questions do not hesitate to ask.

     
    Regards,
    Dimitar
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top