I have an Entity Framework 6 fluent model in which there is a many to many relationship between an Employee and Teams. The EF model represents the teams that an employee is a member of by an ICollection.
I'm trying to list employees and their associated teams in a declarative hierarchical grid in which the parent table displays an Employee's details and the detail/hierarchical table displays the teams. I'm trying to figure out if it possible to use the ICollection<Teams> to display the list of teams in the detail grid. I tried numerous ways with various datasourceIds, DataKeynames etc. - and also looked at demos/sample
Outline of code is below:
public partial class Employees
{
public int EmployeeId { get; set; }
public string EmployeeFirstName { get; set; }
public string EmployeeLastName { get; set; }
public virtual ICollection<Teams> Teams{ get; set; }
}
public partial class Teams
{
[
public int TeamId{ get; set; }
public string TeamName{ get; set; }
public virtual ICollection<Employees> Employees { get; set; }
}
<ef:EntityDataSource ID="EntityDataSource1" runat="server" ContextTypeName="EF6Model" EntitySetName="Employees" Include="Teams"></ef:EntityDataSource>
<telerik:RadGrid ID="RadGrid1" >
<MasterTableView DataSourceID="EntityDataSource1" DataKeyNames="EmployeeId" >
<Columns>
<telerik:GridBoundColumn HeaderText="First Name" DataField="EmployeeFirstName">
</telerik:GridBoundColumn>
...................Employee A data here.......
</Columns>
<DetailTables>
<telerik:GridTableView>
.................Team 1 that Employe A is a member of here...............
.................Team 2 that Employe A is a member of here...............
.................Team 1 that Employe A is a member of here...............
</telerik:GridTableView>
</DetailTables>
</MasterTableView>
</telerik:RadGrid>