repeater and querrystring

  • Thread starter Thread starter Kelly Zhu
  • Start date Start date
K

Kelly Zhu

The repeater control works fine for me. But how can I make it accept a
querrystring? The repeater has a tag called selectcommand. Can I insert a
where clause including the querrystring? Thanks.
 
The repeater control works fine for me. But how can I make it accept a
querrystring? The repeater has a tag called selectcommand. Can I insert a
where clause including the querrystring? Thanks.

You can use an SqlDataSource control with the Repeater, and the
SqlDataSource can get its parameters from the querystring. Here's an
example:

<asp:Repeater ID="Repeater1" runat="server"
DataSourceID="SqlDataSource1" />

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="..."
SelectCommand="SELECT @parameter AS data">
<SelectParameters>
<asp:QueryStringParameter Name="parameter"
QueryStringField="parameter" />
</SelectParameters>
</asp:SqlDataSource>

-Michael Placentra II
 
Back
Top