Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
35
Binding to Sub Objects
posted

When setting a DataSource to an array of object and there sub objects within the object, how do you access the DataFieldName?  I have tried:

DataFieldName="Customer.CompanyName"

but that does not seem to work and I can't find any example of this, so is this even supported?

 

  • 150
    Suggested Answer
    posted

    Hello kmarkle,

    The easiest way to do this is to create wrapper for the data you want in the grid and then create List<MyDataWrapperClass>. Then bind the grid to it.

    Hope that helps.

    Christo Djambov

  • 12679
    posted

    Hello kmarkle,

    If you provide DataSource for the grid which is an array of objects and autoGenerateColumns is equals to true the grid will generate its columns( BoundDataFields) based on the public properties of these object. Could you provide more information about your scenario, why you would like to get this in that way?  

    Thanks