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

Autocomplete + Focus issue

5 Answers 283 Views
ListControl
This is a migrated thread and some comments may be shown as answers.
Alexandre
Top achievements
Rank 1
Alexandre asked on 11 Sep 2013, 09:27 PM
Hi there,
I am working with some RadDropDownList with Autocompletemode setted at SuggestAndAppend. The issue happen when when I do press enter or selected a value from dropdown I can't set focus on an other value once the value have been picked. Could you please provide me a workarround for this issue? 

Thanks
Alex

5 Answers, 1 is accepted

Sort by
0
Alexandre
Top achievements
Rank 1
answered on 13 Sep 2013, 12:33 PM
I do set the focus on the Keypress event and SelectedIndexChanged both of them didn't work.
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 16 Sep 2013, 03:49 PM
Hello Alexandre,

Thank you for contacting Telerik Support.

RadDropDownList supports AutoCompleteMode = SuggestAppend which means that when typing on the textbox, the autocomplete pop-up shows below with the filtered results along with auto appended text to the textbox. Selecting a value by clicking an item or pressing the Enter key, automatically closes the auto complete pop-up. It will be opened automatically again when typing some text. This is the desired behaviour. Could you please provide more details about the exact scenario which you are trying to achieve with the autocomplete pop-up which differs from the supported one? Thank you in advance.

Regards,
Desislava
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Alexandre
Top achievements
Rank 1
answered on 16 Sep 2013, 04:31 PM
Thanks for the answer.

I understand what you say and at this point everything is fine but when I write in the DLL Al and that append ex for Alex and I press enter that fire the selectedindexchanged event where I set the focus on the next DDL the issue happen. I see the focus go on the second DDL but come back to the first one. I also tried on the keypress event and the issue come again but never happen when autocompletemode setted to none...
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 19 Sep 2013, 11:16 AM
Hello Alexandre,

Thank you for writing back.

In order to change the focus to the second RadDropDownList after selection from the AutoComplete of the first RadDropDownList (pressing Enter key), you may use the following code snippet:
private void Form1_Load(object sender, EventArgs e)
{
    // TODO: This line of code loads data into the 'nwindDataSet1.Employees' table. You can move, or remove it, as needed.
    this.employeesTableAdapter.Fill(this.nwindDataSet1.Employees);
    // TODO: This line of code loads data into the 'nwindDataSet.Customers' table. You can move, or remove it, as needed.
    this.customersTableAdapter.Fill(this.nwindDataSet.Customers);
 
    this.radDropDownList1.DisplayMember = "ContactName";
    this.radDropDownList2.DisplayMember = "LastName";
    this.radDropDownList1.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
    this.radDropDownList2.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
 
    this.radDropDownList1.GotFocus += radDropDownList1_GotFocus;
    this.radDropDownList1.DropDownListElement.AutoCompleteSuggest.DropDownList.PopupClosed += radDropDownList1_PopupClosed;
}
 
bool flag = false;
 
private void radDropDownList1_PopupClosed(object sender, RadPopupClosedEventArgs args)
{
    if (args.CloseReason == Telerik.WinControls.UI.RadPopupCloseReason.Keyboard)
    {
        flag = true;
        this.radDropDownList2.DropDownListElement.TextBox.TextBoxItem.HostedControl.Select();
    }
}
 
private void radDropDownList1_GotFocus(object sender, EventArgs e)
{
    if (flag)
    {
        this.radDropDownList2.DropDownListElement.TextBox.TextBoxItem.HostedControl.Select();
    }
 
    flag = false;
}      

Please, find the attached video (drag and drop over the browser to play), demonstrating the implemented behaviour.

I hope this information helps. Should you have further questions, I would be glad to help.

Regards,
Desislava
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Alexandre
Top achievements
Rank 1
answered on 24 Sep 2013, 01:11 PM
I did something like this to do what I had to do.

Thanks for the solution :)
Tags
ListControl
Asked by
Alexandre
Top achievements
Rank 1
Answers by
Alexandre
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or