We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Cell focus after row add

Hi All :

When I enable add new on Grid Grouping Cell, if I have end edit on the last column, after press enter key, the new record will be place on the last row and the cursor will focus on the last row and last column.
My question is :

How to make the input cursor back to the top row and the first column and then allow user to enter the new record without use the mouse click

Thanks

Michael

4 Replies

MK Michael K July 2, 2016 06:36 AM UTC

Hi :

And one more question, how to get th event of  on Grid Grouping Control after row add

Thanks


AR Amal Raj U Syncfusion Team July 4, 2016 12:59 PM UTC

Hi Michael, 

Thanks for using Syncfusion products. 

 
 
 
 
 
 
How to make the input cursor back to the top row and the first column and then allow user to enter the new record without use the mouse click 
In order to set AddNewRecord as current record when enter key is pressed in last column,  CurrentCell.MoveTo() can be used. Please make use of the below code. 

Code Snippet 
//event hookup 
this.gridGroupingControl1.TableControlCurrentCellKeyDown += new Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlKeyEventHandler(gridGroupingControl1_TableControlCurrentCellKeyDown); 

//to set addnewrecord as current cell. 
void gridGroupingControl1_TableControlCurrentCellKeyDown(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlKeyEventArgs e) 
   if (e.Inner.KeyCode == Keys.Enter && e.TableControl.CurrentCell.ColIndex == e.TableControl.TableDescriptor.Columns.Count  
                && e.TableControl.CurrentCell.RowIndex == e.TableControl.Model.RowCount) 
   { 
      e.TableControl.CurrentCell.MoveTo(e.TableControl.TopRowIndex - 1, 1, GridSetCurrentCellOptions.SetFocus, false); 
      e.TableControl.SelectRecords.Clear(); 
   } 
  
 
 
 
 
how to get the event of  on Grid Grouping Control after row add 
The new record added to grid can be identified from SourceListRecordChanged event. Please make use of the below code. 
 
Code Snippet 
//event hookup 
this.gridGroupingControl1.SourceListRecordChanged += new Syncfusion.Grouping.RecordChangedEventHandler(gridGroupingControl1_SourceListRecordChanged); 
 
void gridGroupingControl1_SourceListRecordChanged(object sender, Syncfusion.Grouping.RecordChangedEventArgs e) 
   if (e.Action == RecordChangedType.Added) 
   { 
      //process that needs to be done. 
   } 

Regards, 
Amal Raj U. 



MK Michael K July 4, 2016 02:35 PM UTC

Dear Raj :

Yes. your snippet code is what I need, 

Thanks for your help




AR Amal Raj U Syncfusion Team July 5, 2016 04:12 AM UTC

Hi Michael, 

Thanks for your update. 

We are glad to know that the given solution has solved your query. Please let us know, If you need any further assistance. 

Regards, 
Amal Raj U. 


Loader.
Live Chat Icon For mobile
Up arrow icon