Completed
Last Updated: 09 Jul 2014 11:58 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 14 Apr 2014 06:58
Category:
Type: Bug Report
1
FIX. RadDropDownList - Autocomplete dropdown is not refreshed after changing the data source
FIX. RadDropDownList - Autocomplete dropdown is not refreshed after changing the data source

To reproduce:

1 - Add a RadDropDownList and a RadButton to the form. Use the following code snippet:
public Form1()
{
    InitializeComponent();

    this.radButton1.Click+=radButton1_Click;

    SetDomain("AA");
    this.radButton1.Text = "Set to BB";
}

private void radButton1_Click(object sender, EventArgs e)
{
    if (this.radButton1.Text == "Set to AA")
    {
        SetDomain("AA");
        this.radButton1.Text = "Set to BB";
    }
    else
    {
        SetDomain("BB");
        this.radButton1.Text = "Set to AA";
    }
}

DataTable parentDataTable;

public void SetDomain(string name)
{
    parentDataTable = new DataTable("Data");
    parentDataTable.Columns.Add("P1", typeof(decimal));
    parentDataTable.Columns.Add("P2", typeof(string));
    for (int x = 1; x <= 5; x++)
    {
        parentDataTable.Rows.Add(x, name + x.ToString());
    }

    this.radDropDownList1.DataSource = parentDataTable;
    this.radDropDownList1.DisplayMember = "P2";
    this.radDropDownList1.ValueMember = "P1";

    this.radDropDownList1.DropDownStyle = RadDropDownStyle.DropDown;
    this.radDropDownList1.AutoCompleteMode = AutoCompleteMode.SuggestAppend;

    this.radDropDownList1.DropDownListElement.AutoCompleteSuggest.SuggestMode = SuggestMode.Contains;

    this.radDropDownList1.SelectedValue = null;
    this.radDropDownList1.Text = "";
}


2 - Type A to get dropdown list with AA1 to AA5
3 - Escape to collapse the list
4 - Click the "Set to BB" button
5 - Type A again in the list and again AA1 to AA5 is presented even though the datatable now contains BB1 to BB5
6 - Click on the dropdown arrow repeatedly and the dropdown list toggles between AA and BB lists.

Workaround: before setting the DataSource property, set it to null and clear the Items list:
this.radDropDownList1.DataSource = null;
this.radDropDownList1.Items.Clear();
0 comments