<tr class="tr1"> <td> 共<asp:Literal runat="server" ID="litNum"></asp:Literal>条内容 </td> <td colspan="4"> <div style="font-size: 12px; line-height: 22px; font-family: Arial; position: relative; height: 22px"> <zzz:AspNetPager ID="Pager1" runat="server" PageSize="20" ShowInputBox="Always" UrlPaging="true" AlwaysShow="true" LastPageText="末页" NextPageText="下一页" FirstPageText="首页" PrevPageText="上一页"> </zzz:AspNetPager> </div> </td> <td align="middle"> </td> </tr>
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using NHibernate; using NHibernate.Expression; using System.Data; using Webdiyer.WebControls.Mvc;
int recordcount = 0; int page = 1; page = (string.IsNullOrEmpty(Request.QueryString["page"])) ? 1 : int.Parse(Request.QueryString["page"]); //int firstnum = (page == 1) ? 0 : ((page - 1) * Pager1.PageSize); string sqlstr = string.Format("SELECT * FROM Vouchers order by Status desc limit {0} offset {0}*{1}", Pager1.PageSize, page - 1); DataSet ds = SQLiteHelper.ExecuteQuery(sqlstr); DataTable dt = ds.Tables[0]; recordcount = int.Parse(dt.Rows[0][0].ToString()); rptPage.DataSource = dt; rptPage.DataBind(); litNum.Text = recordcount.ToString(); Pager1.RecordCount = recordcount/10; Pager1.CurrentPageIndex = page; web.congif
<system.web> <compilation debug="true" targetFramework="4.0"/> <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" validateRequest="false"> <controls> <add namespace="Wuqi.Webdiyer" assembly="AspNetPager" tagPrefix="zzz"/> <add namespace="Business.Project.Website" assembly="TyTextBox" tagPrefix="dry"/> <add namespace="PageCtrl" assembly="PageCtrl" tagPrefix="cc1"/> </controls> </pages> </system.web>
时间: 2024-09-19 03:04:46