WHERE Clause from separate tables using EntityDataSource

asp.net c# entity-framework

Question

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.

1
1
11/26/2012 6:24:10 AM

Accepted Answer

Have you looked at this tutorial?
It gives some hints about the Where clauses, involving related entities as well.
If this doesn't help, take a look at this question, it deals with the Selecting event that gives more flexibility.

2
5/23/2017 12:14:15 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow