I have found a GridView on an asp.net page. I want to set gridview datasource in the trackable collection of unit framework objects. However, the code should look like this:
this.gvMyGridView.DataSource = entity.MyDetailedItems; This.gvMyGridView.DataBind (); But it does not display any data.
I am using tracking entities myself and MyDetailedItems is the navigation property of rows from another table. EF4 with
If you want to use them, you should explicitly load navigation properties Will happen. Either:
// Related units use the loading entity with var entity = context.Entities.Include ("MyDetailedItems"). Single (...); or
// Load related entities for pre-loaded entry context. LoadProperty (unit, "MyDetailedItems");
Comments
Post a Comment