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

DropDownList with datasource, not working as expected

1 Answer 87 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 07 Jun 2015, 11:46 AM
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();
    }
}

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 08 Jun 2015, 01:59 PM
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
Tags
DropDownList
Asked by
Robert
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or