parent gdbg record count

Hello,

This is likely a simple question, but I am stuck at the moment.

I have two GridDataBoundGrids, each with the same dataset as its datasource.

The dataset has two tables in it, MyParentTable and MyChildTable.

There is a FK relation between these tables called FK_ParentChild.

The datamembers on the GridDataBoundGrids 1 and 2 are MyParentTable and MyParentTable.FK_ParentChild, respectively.

Therefore, row selections in GDBG1 filter the rows shown in GDBG2.

My question is, from a GDBG2 event, such as Enter, how do I retrieve the number of rows shown in GDBG1? The trick is my form is created dynamically from metadata stored in a database, so I don't know beforehand how the grids are linked.

Thanks,
Keith

2 Replies

LS Lingaraj S Syncfusion Team January 12, 2010 02:25 PM UTC

Hi Keith,

Thank you for your interest in Syncfusion products.

Please refer the below forum thread, similar kind of behavior has been discussed.
http://www.syncfusion.com/support/forums/grid-windows/89652/Re--issue-in-GridQueryCellInfoEventHandler

Please let me know if it helps.

Regards,
Lingaraj S.


LS Lingaraj S Syncfusion Team January 12, 2010 03:00 PM UTC

Hi Keith,

Sorry, please ignore the previous update.

Try using using below way in GDBG2 events to achieve your requirement as shown below.

this.gridDataBoundGrid1.CurrentCellKeyDown += new KeyEventHandler(gridDataBoundGrid1_CurrentCellKeyDown);
void gridDataBoundGrid1_CurrentCellKeyDown(object sender, KeyEventArgs e)
{
Control grid2=sender as Control;
if (e.KeyCode == Keys.Enter)
{
Form f = FindFormHelper.FindForm((GridDataBoundGrid)sender);
foreach (Control con in f.Controls)
{
GridDataBoundGrid grid1 = con as GridDataBoundGrid;
if (grid1!=null)
{
if (con!=grid2)
{
MessageBox.Show(grid1.Model.ColCount.ToString());
}
}
}
}
}



Please let me know if you have any queries.

Regards,
Lingaraj S.

Loader.
Up arrow icon