HomeIsWhereThePcIs
HomeIsWhereThePcIs

Reputation: 1464

Filter GridView populated with EntityDataSource by where

I have a GridView that uses a EntityDataSource. In this GridView there is a column that contains some foreign keys (ID's). I get the ID I want to display as a parameter in the website ("Details.aspx?id=1"). How do i get the parameter from the URL in the Where Expression of the EntityDataSource?

The parameter source dropdown displays these sources : Cookie, Control, Form, Profile, QueryString, Session, RouteData. Which one do I need to use to get the id from the url?

So far I created the entire webpage using just the interface (didn't write any cod).

Upvotes: 1

Views: 201

Answers (1)

scartag
scartag

Reputation: 17680

The entitydatasource supports a querystringparameter object.

From the designer you can specify it.

Or you could do declaratively in the aspx.

<WhereParameters>
     <asp:QueryStringParameter DbType="Int32" Name="id" QueryStringField="id" />
  </WhereParameters>

Upvotes: 1

Related Questions