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
close icon

Iterate through child rows in grid

Hello, 

How can i iterate through child records of a grid?
I have a drop down column in child records, and i would like to mae this drop down column read only or write only depending on my criteria. 

3 Replies

JP Jagadeesan Pichaimuthu Syncfusion Team May 30, 2019 01:57 PM UTC

Hi Kiran,  
 
Thanks for using Syncfusion product.  
 
By default, GridControl does not have the support for nested table. So, can you please confirm whether that you are using GridControl or GridGroupingControl. If you are using GridControl, please provide the some more details about the GridControl settings. It will be more helpful for us to provide the solution at the earliest.  
 
Regards, 
Jagadeesan 



KI Kiran May 30, 2019 04:32 PM UTC

Hi Jagadeesh, 
I am using groupgrid in my application.


DB Dinesh Babu Yadav Syncfusion Team May 31, 2019 10:41 AM UTC

Hi Kiran, 
 
Thanks for your update. 
 
To iterate the child records, you could use the GetTable method to get the child table to get the records. Please refer the following code example and the sample. 
 
C# 
var childRecords = this.gridGroupingControl1.GetTable("Child").Records; 
foreach (Record rec in childRecords) 
{ 
    //Iterate all child records 
} 
 
var parentRecord = this.gridGroupingControl1.Table.Records[0]; 
var cRecords = parentRecord.GetRelatedChildTable(this.gridGroupingControl1.TableDescriptor.Relations[0]).Records; 
foreach (Record cRec in cRecords) 
{ 
    //Iterate the child records based on the parent record 
} 
//To read the record value based on the column name 
var value = parentRecord.GetValue("Name"); 
 
Please get back to us if you need any further assistance on this. 
 
Regards, 
Dinesh Babu Yadav 
 


Loader.
Live Chat Icon For mobile
Up arrow icon