Completed
Last Updated: 01 Oct 2014 12:17 by ADMIN
ADMIN
George
Created on: 10 Mar 2014 08:35
Category:
Type: Bug Report
0
FIX. RadDropDownList - AutoCompleteMode set to SuggestAppend and SuggestMode to contains does not update the text of the dropdownlist correctly when selecting the same item
To reproduce:
Setup RadDropDownList as follows:

DataTable parentDataTable = new DataTable();
parentDataTable.Columns.Add("P1", typeof(decimal));
parentDataTable.Columns.Add("P2", typeof(string));

parentDataTable.Rows.Add({
    1,
    "match_at_start"
});
parentDataTable.Rows.Add({
    2,
    "contains_match"
});

dd.DataSource = parentDataTable;

dd.DisplayMember = "P2";

dd.SelectedItem = null;

dd.DropDownStyle = RadDropDownStyle.DropDown;
dd.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
dd.DropDownListElement.AutoCompleteSuggest.SuggestMode = SuggestMode.Contains;

Start the project, type "ma" in the DropDownList, using the arrows select the first item and click tab. Delete the text in the DropDownList and type "ma" again, press the arrow down and you will notice that the text is not being updated.

Workaround:

Handle the KeyUp event: 

this.dd.KeyUp += KeyUp;

private void KeyUp(object sender, KeyEventArgs e)
{
    if (e.KeyCode == Keys.Down || e.KeyCode == Keys.Up) 
{
        if (this.dd.DropDownListElement.Text != this.dd.DropDownListElement.Items(this.dd.DropDownListElement.SelectedIndex).Text) 
{
            this.dd.DropDownListElement.Text = this.dd.DropDownListElement.Items(this.dd.DropDownListElement.SelectedIndex).Text;
        }
    }
}

0 comments