Combobox Column and Enter Key

2 posts, 0 answers
  1. Matthew
    Matthew avatar
    16 posts
    Member since:
    Oct 2010

    Posted 23 Feb 2012 Link to this post

    Hi,

    I've posted about this before, but two days later the thread disappeared, wierd!
    Anyway, i have more details now.
    I have an app which uses a gridview with a combobox column. the combobox column uses suggestAppend
    It seems the combobox column, by default, requires the user to hit enter twice before EndEdit is called.

    The grid itself has a custom GridBehavior to override ProcessKey such that when enter is pressed, it calls EndEdit and SelectNextRow
    This is so that on the combobox column, the user only has to hit enter once.

    this worked on version 2010.2.10.914 of the telerik controls, i am now using the latest version and it no longer works. ProcessKey is never called while the suggestions list is showing.

    Is there a way for me to get the KeyPress events from the suggestion box to bubble up to the gridview?

    Thanks,
    Matt
  2. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 24 Feb 2012 Link to this post

    Hello Matthew,

    Thank you for writing.

    The thread did not disappear, it was converted into a support ticket (for reasons described there) and can be found in Your Account. Please find your answer there.

    To handle the case where you want after selecting a value in the combo box to move the grid to the next row, please add to the PopupClosed event handler a call to the SelectNexrRow method of the grid navigator. Here is all the code:
    void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
     {
         RadDropDownListEditor editor = this.radGridView1.ActiveEditor as RadDropDownListEditor;
         if (editor != null)
         {
             RadDropDownListEditorElement editorElement = (RadDropDownListEditorElement)editor.EditorElement;
             editorElement.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDown;
             editorElement.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
             editorElement.PopupClosed -= new RadPopupClosedEventHandler(editorElement_PopupClosed);
             editorElement.PopupClosed += new RadPopupClosedEventHandler(editorElement_PopupClosed);
             editorElement.AutoCompleteSuggest.DropDownList.PopupClosed += new RadPopupClosedEventHandler(DropDownList_PopupClosed);
         }
     }
     
     void DropDownList_PopupClosed(object sender, RadPopupClosedEventArgs args)
     {
         radGridView1.EndEdit();
         this.radGridView1.GridNavigator.SelectNextRow(1);
     }
     
     void editorElement_PopupClosed(object sender, RadPopupClosedEventArgs args)
     {
         radGridView1.EndEdit();
         this.radGridView1.GridNavigator.SelectNextRow(1);
     }

    I hope this helps. Please reply with the requested information in the other thread which you have submitted.
     
    Kind regards,
    Stefan
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Back to Top