平时都觉得分页是个麻烦事  这次在网上下了aspnetpage.dll这个分页控件真不错 
     方便  样式好把握 

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class cn_a : System.Web.UI.Page
{
    private int sRecordCount;
    info info = new info();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            BindData();
            this.AspNetPager1.RecordCount = sRecordCount;
        }
    }

    private void BindData()
    {
        DataSet ds = info.GetDataList("Info", "*","InfoID",this.AspNetPager1.PageSize, this.AspNetPager1.CurrentPageIndex, ref sRecordCount, 0, "0=0");
        GridView1.DataSource = ds;
        GridView1.DataBind();
     
    }

    protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        BindData();
    }
}

简单的代码解决问题

相关文章:

  • 2021-10-14
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-15
  • 2021-11-11
  • 2022-02-08
相关资源
相似解决方案