How do i show EntityCollection in my GridView

197 Views Asked by At

In my web application (ASP.NET 4.0) I have two tables, Committee and CommitteeUser (committeeId,UserId,RoleId). Each Committee can have multiple CommitteeUser.

I have a GridView and want to show Committee with the CommitteeUser that roleId's =1. I did it by a EntityDataSource like :

<asp:EntityDataSource ID="EntityDataSource1" runat="server" 
    ContextTypeName="SuggestionApp.DataModel.SuggestionAppDBEntities"
    EntitySetName="Committees" Include="CommitteeUsers.User" 
    EnableFlattening="False" EnableUpdate="True" EnableInsert="True" 
    Where="EXISTS(SELECT VALUE u FROM it.CommitteeUsers AS u 
            WHERE u.Role_Id = 1)">
</asp:EntityDataSource>

How can I show a field of CommitteeUser object in my grid?

0

There are 0 best solutions below