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

when I press down arrow key in current cell of row then how to set focus to cell of next row in parent table as well as child table

Hi,
I am using Gridgrouping control.
I have Parent-Child Relationship in the control.
I want to change values in cell of  rows values in child table.
when  I press down arrow key in current cell of row then   how to set focus  to cell of next row in parent table as well as child table
Please give me solution regarding to this.

Thank you and Regards,
Supriya

1 Reply

MK Muthukumar Kalyanasundaram Syncfusion Team January 11, 2015 03:38 PM UTC

Hi Supriya,

 

Thank you for your interest in Syncfusion products.

 

If you want to set focus to next row of parent table as well as child table while pressing down arrow key in gridgroupingcontrol, you can use “TableControlKeyDown” event and focus particular cell by using “MoveTo()”method and set the “GridSetCurrentCellOptions” as SetFocus. Please refer the below code,

 

Code:

this.gridGroupingControl1.TableControlKeyDown += new GridTableControlKeyEventHandler(gridGroupingControl1_TableControlKeyDown);

 

void gridGroupingControl1_TableControlCurrentCellKeyDown(object sender, GridTableControlKeyEventArgs e)

{

GridCurrentCell cc = e.TableControl.CurrentCell;

GridTable tablechild = this.gridGroupingControl1.GetTable("MyChildTable");

GridTableCellStyleInfo style = tablechild.GetTableCellStyle(cc.RowIndex, cc.ColIndex);

if (e.Inner.KeyCode == Keys.Down)  // pressing Down arrow key

{

if (tablechild.CurrentRecord != null) // child table

{

e.TableControl.CurrentCell.MoveTo(GridRangeInfo.Cell(cc.RowIndex + 1, cc.ColIndex), GridSetCurrentCellOptions.SetFocus);

}

else // parent table

{

e.TableControl.CurrentCell.MoveTo(GridRangeInfo.Cell(cc.RowIndex + 1, cc.ColIndex), GridSetCurrentCellOptions.SetFocus);

}

e.Inner.Handled = true;

}

}

 

Please let us know if you have any concern.

 

Regards,

Muthukumar K



Attachment: Related_Master_Details_Demo_c373e530.zip

Loader.
Up arrow icon