asp.net換頁控制項之不同頁切換
來源:互聯網
上載者:User
using System;
using System.Data;
using System.Configuration;
using System.Collections;
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 Findsoft;
public partial class ShowPay : System.Web.UI.Page
{
static DataTable dtPay = new DataTable();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void butSearch_Click(object sender, EventArgs e)
{
string strSql="";
strSql+="select * from pay";
dtPay = AdoFunc.GetTable(strSql);
ShowPage(0);
}
protected void frmPay_PageIndexChanging(object sender, FormViewPageEventArgs e)
{
ShowPage(e.NewPageIndex);
}
private void ShowPage(int PageNo)
{
frmPay.PageIndex = PageNo;
frmPay.DataSource = dtPay;
frmPay.DataBind();
lblPageNo.Text = "當前頁 " + ((int)(frmPay.PageIndex + 1)).ToString() + " 共 " + frmPay.PageCount.ToString() + " 頁";
}
}