asp.net换页控件之不同页切换

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() + " 页";
    }
}

你可能感兴趣的:(asp.net)