Enter key act like Tab key

2 posts, 1 answers
  1. Daniel Woodard
    Daniel Woodard avatar
    13 posts
    Member since:
    Aug 2005

    Posted 11 Oct 2011 Link to this post

    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?
  2. Answer
    Peter
    Admin
    Peter avatar
    1148 posts

    Posted 13 Oct 2011 Link to this post

    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.

  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top