根据所选范围显示产品的asp.net代码? [英] asp.net code for display product according to tha selected ranges?

查看:61
本文介绍了根据所选范围显示产品的asp.net代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以尝试........

我对价格范围有一个项目符号控制,例如500,> 500< 1000,> 1000< 2000,> 2000 ....像这样...

在此,当我单击500时,它应该显示500范围内的所有产品...对所有产品都相同.........

帮助任何人都可以知道这一点....

Can anyone try this........

i have a bulletedlist control for price ranges such as 500,>500&<1000,>1000&<2000,>2000....like this...

in this when i click 500,it should shows all the products in 500 range...same for all.........

help can anyone know this....

推荐答案



使用以下代码:

.ASPX

Hi,

Use following code:

.ASPX

<asp:BulletedList ID="blPriceRange"  runat="server"

           onclick="blPriceRange_Click" DisplayMode="LinkButton">
           <asp:ListItem Text="500" Value="Price = 500"></asp:ListItem>
           <asp:ListItem Text=">500" Value="Price > 500 AND Price < 1000"></asp:ListItem>
           <asp:ListItem Text=">1000" Value="Price > 1000 AND Price < 2000"></asp:ListItem>
           <asp:ListItem Text=">2000" Value="Price > 2000 "></asp:ListItem>
       </asp:BulletedList>



.ASPX.CS



.ASPX.CS

protected void blPriceRange_Click(object sender, BulletedListEventArgs e)
  {
      string filterCriteria = blPriceRange.Items[e.Index].Value;
      string SQLQuery = "SELECT * FROM Products WHERE " + filterCriteria;
      DataTable dt = new DataTable();
      dt = DB.ExecuteNonQuery(SQLQuery);
      if (dt.Rows.Count > 0)
      {
          GridView1.DataSource = dt;
          GridView1.DataBind();
      }
  }



谢谢,
Imdadhusen



Thanks,
Imdadhusen


这篇关于根据所选范围显示产品的asp.net代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆