Sonic
Sonic

Reputation: 39

Filtering EntityDataSource with Parameters from a another page

i have two pages, a Master Page containing a list of all products and a seperate detail pages obviously containing all the details about said product.

In the master page, i have a grid view and by clicking on a link label which for any particular row, should show up the other page (details page) with information based on the id.

DataNavigateUrlFields: ID DataNavigateUrlFormatString : EmployeeFinanceDetailsPage.aspx?id={0}

This is what i added to the link label, trying to post the id to the details page. by the way, i am using purely entity data source. I have my entity data model configured and working properly.

In my details page, i have a form view configure with a data source as shown below.

<asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=sspEntities" DefaultContainerName="sspEntities"
EnableDelete="True" EnableFlattening="False" EnableInsert="True"
EnableUpdate="True" EntitySetName="Employee_Financial"
EntityTypeFilter="" Select="" Where="" AutoGenerateWhereClause="True">
WhereParameters> <asp:FormParameter DbType="Int32" DefaultValue="0"
FormField="ID" Name="ID" /> </WhereParameters>
</asp:EntityDataSource>

For some reason this page keeps showing up blank, i dont know what i am doing wrong. i even tried removing AutoGenerateWhereClause but i still got the same result. what am i doing wrong? thanks for your advice in advance.

Upvotes: 1

Views: 1290

Answers (1)

Richard Deeming
Richard Deeming

Reputation: 31248

You're using a FormParameter, but passing the ID in the query-string. Try a QueryStringParameter instead.

<WhereParameters>
   <asp:QueryStringParameter 
      DbType="Int32" 
      DefaultValue="0"
      QueryStringField="ID" 
      Name="ID" 
   /> 
</WhereParameters>

Upvotes: 1

Related Questions