数据的条件组合查询并进行分页展示(未加各种限定)★★★

时间:2021-09-02 07:32:11

<%@ Page Language=http://www.mamicode.com/"C#" AutoEventWireup=http://www.mamicode.com/"true" CodeFile=http://www.mamicode.com/"Default.aspx.cs" Inherits=http://www.mamicode.com/"_Default" %> <!DOCTYPE html> <html xmlns=http://www.mamicode.com/""> <head runat=http://www.mamicode.com/"server"> <meta http-equiv=http://www.mamicode.com/"Content-Type" content=http://www.mamicode.com/"text/html; charset=utf-8" /> <title></title> <style> * { padding: 0px; margin: 0px; } #div0 { width: 1000px; position: relative; margin: 0px auto; } #tb1 { width: 100%; text-align: center; } </style> </head> <body> <form id=http://www.mamicode.com/"form1" runat=http://www.mamicode.com/"server"> <div id=http://www.mamicode.com/"div0"> Name:<asp:TextBox ID=http://www.mamicode.com/"txt_name" runat=http://www.mamicode.com/"server"></asp:TextBox> Brand:<asp:TextBox ID=http://www.mamicode.com/"txt_brand" runat=http://www.mamicode.com/"server"></asp:TextBox> Price:<asp:DropDownList ID=http://www.mamicode.com/"ddl_price" runat=http://www.mamicode.com/"server"> <asp:ListItem Value=http://www.mamicode.com/"=">等于</asp:ListItem> <asp:ListItem Value=http://www.mamicode.com/">=">大于等于</asp:ListItem> <asp:ListItem Value=http://www.mamicode.com/"<=">小于等于</asp:ListItem> </asp:DropDownList> <asp:TextBox ID=http://www.mamicode.com/"txt_price" runat=http://www.mamicode.com/"server"></asp:TextBox> <asp:Button ID=http://www.mamicode.com/"btn_selectsome" runat=http://www.mamicode.com/"server" Text=http://www.mamicode.com/"查询" /> <asp:Button ID=http://www.mamicode.com/"btn_selectall" runat=http://www.mamicode.com/"server" Text=http://www.mamicode.com/"查询全部" /> <br /> <br /> <table id=http://www.mamicode.com/"tb1" border=http://www.mamicode.com/"1" cellpadding=http://www.mamicode.com/"0" cellspacing=http://www.mamicode.com/"0"> <tr style=http://www.mamicode.com/"background-color: navy; color: white;"> <td>Code</td> <td>Namge</td> <td>Brand</td> <td>Time</td> <td>Oil</td> <td>Powers</td> <td>Exhaust</td> <td>Price</td> <td>Pic</td> <td>操作</td> </tr> <asp:Repeater ID=http://www.mamicode.com/"Repeater1" runat=http://www.mamicode.com/"server"> <ItemTemplate> <tr> <td><%#Eval("Code") %></td> <td><%#Eval("Name") %></td> <td><%#Eval("Brand") %></td> <td><%#Eval("Time") %></td> <td><%#Eval("Oil") %></td> <td><%#Eval("Powers") %></td> <td><%#Eval("Exhaust") %></td> <td><%#Eval("Price") %></td> <td><%#Eval("Pic") %></td> <td> <a href=http://www.mamicode.com/"Update.aspx?name=<%#Eval("name") %>">修改</a> <a href=http://www.mamicode.com/"Delete.aspx?name=<%#Eval("name") %>">删除</a> </td> </tr> </ItemTemplate> </asp:Repeater> </table> <br /> 共【<asp:Label ID=http://www.mamicode.com/"lb_AllInf" runat=http://www.mamicode.com/"server" Text=http://www.mamicode.com/"加载中..."></asp:Label>】条数据&nbsp; 当前第【<asp:Label ID=http://www.mamicode.com/"lb_NowPage" runat=http://www.mamicode.com/"server" Text=http://www.mamicode.com/"加载中..."></asp:Label>】页&nbsp; 共【<asp:Label ID=http://www.mamicode.com/"lb_MaxPageNum" runat=http://www.mamicode.com/"server" Text=http://www.mamicode.com/"加载中..."></asp:Label>】页&nbsp; <asp:Button ID=http://www.mamicode.com/"btn_prev" runat=http://www.mamicode.com/"server" Text=http://www.mamicode.com/"上一页" /> <asp:Button ID=http://www.mamicode.com/"btn_next" runat=http://www.mamicode.com/"server" Text=http://www.mamicode.com/"下一页" /> </div> </form> </body> </html>

二、后台代码