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.
Unfortunately, activation email could not send to your email. Please try again.

How to know the Parent Row of the GridGroupingControl

Thread ID:

Created:

Updated:

Platform:

Replies:

90630 Oct 12,2009 05:41 AM Oct 15,2009 08:31 AM ASP.NET Web Forms (Classic) 1
loading
Tags: Grouping
Ramana
Asked On October 12, 2009 05:41 AM

I'm using GridGroupingControl.I have two tables t1 and t2 which are related through the column "Description" .t1 is parent of t2.When I click on any DataGrid cell of child table, how can i know to which parent row it is related to?. The rows of parent table may contain the same child rows as other child row.

Thanks & Regards,
Ramana.

Rajadurai C [Syncfusion]
Replied On October 15, 2009 08:31 AM

Hi Ramana,

Thanks for your interest in Syncfusion Products.

You can get the parent row details to which a particular child record belongs by accessing the DisplayElement. Please refer to the following code handled in TableControlCellClick event.

GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex);
if (style.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || style.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)
{
if (style.TableCellIdentity.Table.TableDescriptor.Name == "ChildTable")
{
Element ele = style.TableCellIdentity.DisplayElement;
Element el = ele.ParentTable.RelationParentTable.CurrentElement;
Record r1 = el.GetRecord();
if(r1 != null)
MessageBox.Show(r1.Info);
}
}

This code triggers the message box with parent record details when a child record is clicked.

Sample:
http://files.syncfusion.com/support/samples/Grid.Windows/7.3.0.20/F90630.zip

Regards,
Rajadurai

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;