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

Combobox Column and Enter Key

1 Answer 146 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Matthew
Top achievements
Rank 1
Matthew asked on 23 Feb 2012, 06:47 AM
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

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 24 Feb 2012, 03:51 PM
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 >>
Tags
GridView
Asked by
Matthew
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or