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

child grid

hi friends, i am using grid grouping control for displaying the nested data from database and i am using checkbox on child table so i want information of parent record which have child record with checked check box in child grid on button click plz help

4 Replies

AD Administrator Syncfusion Team April 24, 2006 06:32 AM UTC

Hi, Colud you try this code to get the parent record which have child record with checked check box in child grid .Here is a code snippet GridTableControl tc = this.gridGroupingControl1.GetTableControl( "ParentTable"); string s = string.Empty; string parents = string.Empty; foreach(Record r1 in tc.Table.Records) { foreach(Record r in r1.NestedTables[0].ChildTable.Records) { object obj = r.GetValue("Check1") ; if( obj != null && obj.ToString() != string.Empty) { bool checkValue = (bool)r.GetValue("Check1"); if( checkValue ) { s += r.Info + Environment.NewLine; if( r1 != null) parents += r1.Info; } } } } MessageBox.Show( "Child Record Details:"+ Environment.NewLine +s + Environment.NewLine + Environment.NewLine + "Parent Record Details:" + Environment.NewLine + parents , "Checked CheckBox Records"); Here is a sample. http://www.syncfusion.com/Support/user/uploads/GetNestedTableValue_344224e.zip Please let me know if you need any further assistance. Regards, Haneef


BR brijeshkhare April 24, 2006 08:56 AM UTC

>Hi, > >Colud you try this code to get the parent record which have child record with checked check box in child grid .Here is a code snippet > >GridTableControl tc = this.gridGroupingControl1.GetTableControl( "ParentTable"); >string s = string.Empty; >string parents = string.Empty; >foreach(Record r1 in tc.Table.Records) >{ > foreach(Record r in r1.NestedTables[0].ChildTable.Records) > { > object obj = r.GetValue("Check1") ; > if( obj != null && obj.ToString() != string.Empty) > { > bool checkValue = (bool)r.GetValue("Check1"); > if( checkValue ) > { > s += r.Info + Environment.NewLine; > if( r1 != null) > parents += r1.Info; > } > } > } >} >MessageBox.Show( "Child Record Details:"+ Environment.NewLine +s + Environment.NewLine + Environment.NewLine + "Parent Record Details:" + Environment.NewLine + parents , "Checked CheckBox Records"); > >Here is a sample. >http://www.syncfusion.com/Support/user/uploads/GetNestedTableValue_344224e.zip > >Please let me know if you need any further assistance. >Regards, >Haneef hi Haneef i have tried this code but there is a problem Dim tc As GridTableControl = Me.dgPlanDuplicator.GetTableControl("User_Master") but tc contain nothing so in this line For Each r In tc.Table.Records there is an error of object reference not set and remember that i do not have any checkbox on parent table. plz give the solution


AD Administrator Syncfusion Team April 24, 2006 09:39 AM UTC

Hi, GetTableControl method takes the name of the DataTable as argument. It will not accept the name of the dataset as argument.Please try this code Dim tc As GridTableControl = Me.dgPlanDuplicator.TableControl; Here is a modified sample in VB.Net http://www.syncfusion.com/Support/user/uploads/VB_101a14d3.zip Let me know if this helps. Thanks for choosing Syncfusion Products Regards, Haneef


BR brijeshkhare April 25, 2006 09:51 AM UTC

>Hi, > >GetTableControl method takes the name of the DataTable as argument. It will not accept the name of the dataset as argument.Please try this code > >Dim tc As GridTableControl = Me.dgPlanDuplicator.TableControl; > >Here is a modified sample in VB.Net >http://www.syncfusion.com/Support/user/uploads/VB_101a14d3.zip > >Let me know if this helps. > >Thanks for choosing Syncfusion Products >Regards, >Haneef thanks Haneef its working fine

Loader.
Live Chat Icon For mobile
Up arrow icon