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

Add programmatically a column of a nested object

Hi there.

I have a sfDaaGrid showing a list a cities and a I want to show the state that city belongs. I would prefer not to use a master-detail view, just add another column mapping "city.state.name".

Something like this:
ID     CITY            STATE
1       New York     NY 

Is that possible?

Thanks for the help!

3 Replies

JP Jagadeesan Pichaimuthu Syncfusion Team April 15, 2019 10:51 AM UTC

Hi Rafael, 

Thanks for using Syncfusion product. 

You can able to add the column which is in nested object by using the below code snippet for your reference. 

sfDataGrid1.Columns.Add(new GridTextColumn() { MappingName = "Category.CategoryName" });   

And also you can refer the below forum to achieve your requirement in both programmatic and auto generated columns.  

If we misunderstood your requirement, please provide more information regarding the requirement. This would help us to proceed further. 


RA Rafael April 20, 2019 09:54 AM UTC

Hi Jagadeesan,

Sorry for my late response. It worked just fine, thank you so much.

JP Jagadeesan Pichaimuthu Syncfusion Team April 22, 2019 06:40 AM UTC

Hi Rafael, 
Thanks for the update. 
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you. 

Live Chat Icon For mobile
Up arrow icon