views:

12

answers:

1

Hi. I am creating a Dynamic Data Website. For a particular table, I would like to display only specific rows to the user. Meaning I want to filter the rows displayed to the user. Is there a way to change the query that the framework uses to fetch data from the database?

A: 

You don't mention which Framework (3.5 or 4.0) or Data Source (LingtoSQL or SQL, etc) you are using, but, you can accomplish this by adding any number of different select criteria to the data source on the view in question. For example, in L2S and 4.0 :

<asp:LinqDataSource ID="GridDataSource" runat="server" EnableDelete="true" >
    <SelectParameters>
        <asp:QueryStringParameter Name="ProductID" QueryStringField="QProductID" Type="Int32" />
     </SelectParameters>
</asp:LinqDataSource>

In other words, look closely at the SelectParameters of DataSource of the page.

Ash Machine

related questions