speshow--自娱自乐

MSN:Jone_yin@live.cn

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
 平时都觉得分页是个麻烦事  这次在网上下了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();
    }
}

简单的代码解决问题
posted on 2008-06-22 16:41  speshow  阅读(731)  评论(2编辑  收藏  举报