'EntityDataSource - how to do WHERE Clause from different table

Hi I am using EF 4 and EntityDataSource in a Page (WebForms).

This page contains a DropDownList that display UserName. Data from this DropDownList it is from "aspnet_Users". At the moment I am using a single EntityDataSource code belove:

                <asp:EntityDataSource ID="EntityDataSourceListUsers" runat="server" ConnectionString="name=CmsConnectionStringEntityDataModel"
                DefaultContainerName="CmsConnectionStringEntityDataModel" EnableFlattening="False"
                EntitySetName="aspnet_Users" Select="it.[UserId], it.[UserName]">
            </asp:EntityDataSource>

I need to FILTER the UserName associated to a specific ROLE and displaying it in the DropDownList therefore using others tables "aspnet_UsersInRoles" and "aspnet_Roles".

How to do it?

Thanks guys for your time.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source