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

Enter key act like Tab key

1 Answer 302 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Daniel Woodard
Top achievements
Rank 1
Daniel Woodard asked on 11 Oct 2011, 07:37 PM
Is there a way to make the Enter key act like the Tab key for the RadDropDownList?  I have tried the following methods and none actually advance to the focus:

private void dropDownList_KeyDown(object sender, KeyEventArgs e)
{
    if (e.KeyData == Keys.Enter)
    {
        this.ProcessTabKeys(true);
    }
}
 
 
private void dropDownList_KeyPress(object sender, KeyPressEventArgs e)
{
    if (e.KeyChar == (char)Keys.Enter)
    {
        this.ProcessTabKeys(true);
    }
}

I also tried alternatives of the above:

private void dropDownList_KeyDown(object sender, KeyEventArgs e)
{
    if (e.KeyCode == Keys.Enter)
    {
        nextDropDownList.Focus();
        e.Handled = true;
    }
}
 
 
private void dropDownList_KeyPress(object sender, KeyPressEventArgs e)
{
    if (e.KeyChar == (char)Keys.Enter)
    {
        nextDropDownList.Focus();
        e.Handled = true;
    }
}


The only way to advance the focus is to use the Tab key.  In case it makes any difference, I have AutoComplete set to SuggestAppend.

Is there another way to make the Enter key act like the Tab key?

1 Answer, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 13 Oct 2011, 12:21 PM
Hi Daniel,

Thank you for writing.

You should set the focus to the hosted text box control inside the RadDropDownList:

radDropDownList1.DropDownListElement.TextBox.TextBoxItem.HostedControl.Focus();

Please refer to the sample project.

Hope this helps. Let me know if you need additional assistance.

Greetings,
Peter
the Telerik team

Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

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