GridGroupingControl AddNewrecordFieldCell

How do I keep focus on the AddNewRecordFieldCell after a record is added?


1 Reply

SR SubhaSheela R Syncfusion Team September 20, 2008 11:52 AM UTC


Hi Truman,

Thanks for the interest in Syncfusion products.

You can get the GridCurrentCell of the CurrentElement and can move the focus to the first row to achieve the desired behavior. Please refer the following code snippet that shows how to get this behavior.


private void TableControl_MouseUp(object sender, MouseEventArgs e)
{
GridTableDescriptor parentTableDescriptor = this.gridGroupingControl1.GetTable("ParentTable").TableDescriptor;
GridTableDescriptor childTableDescriptor = this.gridGroupingControl1.GetTable("ChildTable").TableDescriptor;

Point pt = new Point(e.X, e.Y);
GridTableCellStyleInfo style = this.gridGroupingControl1.TableControl.PointToTableCellStyle(pt);
if(e.Button == MouseButtons.Right)
{
// show the contextmenu
if(style.TableCellIdentity.Table.TableDescriptor == childTableDescriptor)
this.childcontextMenu.Show(this.gridGroupingControl1.TableControl, pt);
}
}
private void menuItem3_Click(object sender, EventArgs e)
{
//
Element el = this.gridGroupingControl1.Table.CurrentElement;
GridNestedTable gnt = el as GridNestedTable;
gnt.ChildTable.CurrentCell.MoveTo(2,1);
GridCurrentCell cc = this.gridGroupingControl1.TableControl.GetNestedCurrentCell();
this.gridGroupingControl1.TableControl.CurrentCell.BeginEdit();
}


Please refer the sample in the below link that illustrates the above.

http://websamples.syncfusion.com/samples/Grid.Windows/I43220/main.htm

Please let me know if you have any questions.

Regards,
Subhasheela R



Loader.
Up arrow icon