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

Problem with RadDropDownList and BindingSource

1 Answer 155 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
George Saveliev
Top achievements
Rank 1
George Saveliev asked on 19 Jul 2011, 03:46 PM
Hello!

I found the following problem with the latest (v.2011.2 11.712) RadDropDownList:

The drop-down list is bound to the BindingSource. When I assign the binding source's DataSource to a list, the drop-down list control shows the first item but the SelectedItem and SelectedValue fields are still set to null as well as the SelectedIndex is set to -1. In the earlier version the fields were set to the corresponding values. If I assign the drop-down list's DataSource to a list directly, it works well.
using System;
using System.Collections.Generic;
using System.Windows.Forms;
  
namespace Test
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
  
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
  
            List<Data> list = new List<Data>();
            list.Add(new Data() { Value = "A" });
            list.Add(new Data() { Value = "B" });
            list.Add(new Data() { Value = "C" });
  
            radDropDownList1.ValueMember = radDropDownList1.DisplayMember = "Value";
            radDropDownList1.DataSource = bindingSource;
            bindingSource.DataSource = list;
        }
    }
  
    public class Data
    {
        public string Value { get; set; }
    }
}

This is very upsetting issue, because a lot of already tested code places becomes unstable unexpectedly. 

Thank you.

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 21 Jul 2011, 01:19 PM
Hello George,

Thank you for writing.

I can confirm this wrong behavior. We will provide fix for it in our SP release at the end of August.
For now as a workaround, you can assign a list directly as a DataSource or set the BindingSource.DataSource first.

We have added points to your account for reporting the issue. Do not hesitate to contact us if you have other questions.

Regards,
Peter
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
DropDownList
Asked by
George Saveliev
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or