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.
}
} |