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

How to find Parent Record of child table

Hi,
I am using Gridgrouping control.
I have Parent-Child Relationship in the control.
I want to change current cell values in child table.
I want to values of  Parent record of current cell of child table when fire the TableControlCurrentCellEditingComplete event.

Please give me solution regarding to this.

Thank you and Regards,
Supriya

1 Reply

NK Neelakandan Kannan Syncfusion Team January 6, 2015 09:56 AM UTC

Hi Supriya,

Thank you for your interest in Syncfusion products.

If you want to get the Parent record for currently edited child table while editing complete, you can use FilteredChildTable property to get the parent record. Please make use of below code,

Code Snippet:

void gridGroupingControl1_TableControlCurrentCellEditingComplete(object sender, GridTableControlEventArgs e)

        {

if (e.TableControl.Table.TableModel.FilteredChildTable!=null)

            {

                //To get Parent Record for currently edited child table

                Record parentRecord = e.TableControl.Table.TableModel.FilteredChildTable.ParentDisplayElement.ParentRecord;

                //To get column values from parent record

                string column1_Value = parentRecord.GetValue("parentID").ToString();

                string column2_Value = parentRecord.GetValue("ParentName").ToString();

                string column3_Value = parentRecord.GetValue("ParentDec").ToString();

            }

        }

Please refer the below sample:

http://www.syncfusion.com/downloads/support/directtrac/117884/Sample_Parent_Record_Value-145439543.zip

Please let me know if you have any concerns.

Regards,

Neelakandan


Loader.
Live Chat Icon For mobile
Up arrow icon