Completed
Last Updated: 07 Oct 2014 12:22 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 18 Jun 2014 12:38
Category:
Type: Bug Report
1
FIX. RadDropDownList - AutoComplete DataSource is not updated correctly when changing the RadDropDownList.DataSource
To reproduce: add two RadDropDownList controls and use the following code:

DataTable dataOne = null;

DataTable dataTwo = null;
DataTable dataThree = null;
DataTable dataFour = null;

public Form1()
{
    InitializeComponent();
    
    dataOne = new DataTable();
    dataOne.Columns.Add("id", typeof(int));
    dataOne.Columns.Add("label", typeof(string));
    
    for (int i = 0; i < 3; i++)
        dataOne.Rows.Add(i, "Item " + i);
    
    radDropDownList1.DataSource = dataOne;
    
    dataTwo = new DataTable();
    dataTwo.Columns.Add("id", typeof(int));
    dataTwo.Columns.Add("label", typeof(string));
    dataThree = new DataTable();
    dataThree.Columns.Add("id", typeof(int));
    dataThree.Columns.Add("label", typeof(string));
    dataFour = new DataTable();
    dataFour.Columns.Add("id", typeof(int));
    dataFour.Columns.Add("label", typeof(string));
    
    for (int i = 0; i < 100; i++)
    {
        dataTwo.Rows.Add(i + 100, "SubItem " + (i + 100));
        dataThree.Rows.Add(i + 200, "SubItem " + (i + 200));
        dataFour.Rows.Add(i + 300, "SubItem " + (i + 300));
    }
    
    //Setup binding members
    radDropDownList1.DisplayMember = "label";
    radDropDownList1.ValueMember = "id";
    
    radDropDownList2.DisplayMember = "label";
    radDropDownList2.ValueMember = "id";
    radDropDownList2.DataSource = dataTwo;
    radDropDownList2.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
   
    radDropDownList1.SelectedValueChanged += new EventHandler(radDropDownList1_SelectedValueChanged);
}

void radDropDownList1_SelectedValueChanged(object sender, EventArgs e)
{
    var value = (int?)radDropDownList1.SelectedValue;
    if (value.HasValue)
    {
        //Switch out the Datasource if the parent value has changed
        if (value.Value == 0)
        {
            radDropDownList2.DataSource = dataTwo;
        }
        else if (value.Value == 1)
        {
            radDropDownList2.DataSource = dataThree;
        }
        else if (value.Value == 2)
        {
            radDropDownList2.DataSource = dataFour;
        }
        else
        {
            radDropDownList2.DataSource = null;
        }
    }
    else
    {
        radDropDownList2.DataSource = null;
    }
}

1.Select an item from the first RadDropDownList.
2.Start typing in the second RadDropDownList to test the autocomplete functionality. Correct items are displayed.
3.Select another item from the first RadDropDownList.
4.Start typing again in the second RadDropDownList to test the autocomplete functionality. Incorrect items are displayed.

Workaround: before setting the new data source for the RadDropDownList, clear the items in the AutoComplete
RadDropDownList.DropDownListElement.AutoCompleteSuggest.DropDownList.ListElement.Items.Clear();
0 comments