using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
public partial class _Default : System.Web.UI.Page
{
private AdoPager mm_Pager;
protected AdoPager m_Pager
{
get{
if (mm_Pager == null)
mm_Pager = new AdoPager();
return mm_Pager;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
LoadData();
}
private int pageIndex = 1;
private int pageSize = 20;
private int pageCount = -1;
private int recordCount = -1;
private void LoadData()
{
string strQuery = "select a.*,b.KindText from tableTest a left join tableKind b on a.KindCode=b.KindCode ";
string strShow = "ID,Subject,KindCode,KindText";
DataTable dt = m_Pager.ExecutePager(pageIndex, pageSize, strShow, strQuery, "", "ID desc", out pageCount, out recordCount);
GridView1.DataSource = dt;
GridView1.DataBind();
Label1.Text = string.Format("共{0}条记录,每页{1}条,页次{2}/{3}",recordCount,pageSize,pageIndex,pageCount);
}
protected void btnJump_Click(object sender, EventArgs e)
{
int.TryParse(txtPageSize.Text, out pageIndex);
LoadData();
}
}
您可能感兴趣的文章: