Question

I have two dropdown lists which show the minimum and maximum price.

I want to show all product ranges between these two dropdown lists' values in another page using RangeExpression.

Both dropdown lists are on the master page. Now when I click on submit button all of the products should be shown in another page within that price range.

So, what should I do? What should I use as a querystring that I would pass in to it?

I have done this:

<asp:LinqDataSource ID="LinqDataSource1" runat="server" 
     ContextTypeName="linqextenderDataContext" EntityTypeName="" 
     TableName="Products" Where="Category == @Category">
     <WhereParameters>
         <asp:ControlParameter ControlID="dropcategory" Name="Category" 
              PropertyName="SelectedValue" Type="String" />
     </WhereParameters>
 </asp:LinqDataSource>
 <asp:QueryExtender ID="QueryExtender1" runat="server"
      TargetControlID="LinqDataSource1">
      <asp:RangeExpression DataField="Price" MinType="Inclusive"
           MaxType="Inclusive">
           <asp:ControlParameter ControlID="dropmin" Type="Int32"
                PropertyName="SelectedValue" />
           <asp:ControlParameter ControlID="dropmax" Type="Int32" 
                PropertyName="SelectedValue"/>
      </asp:RangeExpression>
  </asp:QueryExtender>

  <asp:Button ID="btnsubmit" runat="server" Text="Submit" 
       style="margin-left:50px" onclick="btnsubmit_Click"/>

Now I want to show all data in another page, so when I redirect it to another page what should I pass?

protected void btnsubmit_Click(object sender, EventArgs e)
{
   Response.Redirect("products.aspx");        
}

No correct solution

OTHER TIPS

You are pretty close.

protected void btnsubmit_Click(object sender, EventArgs e)
{
    Response.Redirect(String.Format("products.aspx?min={0}&max={1}",
                      dropmin.SelectedValue, dropmax.SelectedValue);
}

Then on your page load event, read min and max from the querystring.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top