Hi, how can I bind a RadGrid when I need to include details from more than one entity?
I have the following code that runs, definitely brings back data but does not show anything in my grid (with AutoGenerateColumns set to "true"):
I don't mind admitting my LINQ to Entities knowledge is "ongoing" but you can see what I am trying to do: for every ParentEntity, get me their properties and for every ChildEntity under that, get me their properties as well. I want the grid to display those.
Because the ChildEntity may not necessarilly immediately have a ParentEntity, I can't do a master / detail view with two grids.
Richard
I have the following code that runs, definitely brings back data but does not show anything in my grid (with AutoGenerateColumns set to "true"):
protected void MyGrid_OnNeedDataSource(object sender, GridNeedDataSourceEventArgs e) { using (var context = new MyContainer()) { var d = from data in context.ParentEntity.Include("ChildEntities") select new { data.ParentProperty, data.ChildEntity.FirstOrDefault().ChildProperty }; this.MyGrid.DataSource = d.ToList(); } }I don't mind admitting my LINQ to Entities knowledge is "ongoing" but you can see what I am trying to do: for every ParentEntity, get me their properties and for every ChildEntity under that, get me their properties as well. I want the grid to display those.
Because the ChildEntity may not necessarilly immediately have a ParentEntity, I can't do a master / detail view with two grids.
Richard