I have a List of complex objects containing other objects within that I give as the data source to a gridview.(currently I’m using BoundFields for the columns). I need to bind data to the columns from the objects within at run time. How can this be done?
Share
Use a LINQ projection to flatten (denormalise) the entity graph. You can either create a new
ViewModeltype class, or alternatively bind to an anonymous class, something like this:Use
Field1,Field2on theGridViewproperties for the data bindings.Edit
The above projection, in Lambda syntax: