Hi I'm using EntityDataSource to retrieve my items, and i want to get the items for a particular region. (items and regions has a many to many relationship, thus item has a regions navigation property). and I'm using "IN" to filter the items. tried several combinations and it kept on throwing various errors. how can i get this sorted out:
Below is My DataSource:
<asp:EntityDataSource ID="CataloguesDataSource" runat="server" ConnectionString="name=ModelContainer"
DefaultContainerName="ModelContainer" EnableInsert="false" EnableUpdate="false" OrderBy="it.EndDate desc,it.id desc" Include="it.Regions"
EntitySetName="Catalogues" Select="it.Id,it.Name,it.StartDate,it.EndDate,it.RetailerId"
Where="it.Retailer.Name=@RetailerName and @Region IN (select p.Id from it.Regions as p)" >
<WhereParameters>
<asp:ControlParameter Name="RetailerName" ControlID="hdnRetailer" DbType="String" PropertyName="Value" DefaultValue="abc" />
<asp:ControlParameter Name="Region" ControlID="hdnregion" DbType="Int32" PropertyName="Value" DefaultValue="" />
</WhereParameters>
</asp:EntityDataSource>
Typically using the in keyword is done as follows.
This is with MVC 3 and this is in the controller using Entity framework.