首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

一个页面两个datalist无法进行分页,该如何处理

2012-02-14 
一个页面两个datalist无法进行分页我在一个asp.net页面中放了两个datalist,并且绑定不同的数据。现在我使用

一个页面两个datalist无法进行分页
我在一个asp.net页面中放了两个datalist,并且绑定不同的数据。现在我使用两个自定义方法对两个datalist进行分页,方法以及数据绑定都是在页面load时候调用的。但是当对一个datalist的数据点击下一页是,另外一个datalist也自动分页了,这是为什么?
以下是两个分页代码:
//datalist分页方法
protected   void   dl1(DataTable   dt)
        {

                PagedDataSource   pds1   =   new   PagedDataSource();
                pds1.DataSource   =   dt.DefaultView;
                pds1.AllowPaging   =   true;
                pds1.PageSize   =   5;

                this.lbl_countpage1.Text   =   pds1.PageCount.ToString();

                int   CurPage;
                if   (Request.QueryString[ "Page "]   !=   null)
                        CurPage   =   Convert.ToInt32(Request.QueryString[ "Page "]);
                else
                        CurPage   =   1;

                pds1.CurrentPageIndex   =   CurPage   -   1;

                if   (!pds1.IsFirstPage)
                        this.hyl_pre1.NavigateUrl   =   Request.CurrentExecutionFilePath   +   "?Page= "   +   Convert.ToString(CurPage   -   1);

                if   (!pds1.IsLastPage)
                        this.hyl_next1.NavigateUrl   =   Request.CurrentExecutionFilePath   +   "?Page= "   +   Convert.ToString(CurPage   +   1);

                this.lbl_currentpage1.Text   =   CurPage.ToString();

                this.dl1.DataSource   =   pds1;
                this.dl1.DataBind();
             
        }

//dl2分页方法
    protected   void   dl2(DataTable   dt)
        {

                PagedDataSource   pds   =   new   PagedDataSource();
                pds.DataSource   =   dt.DefaultView;
                pds.AllowPaging   =   true;
                pds.PageSize   =   5;

                this.lbl_countpage.Text   =   pds.PageCount.ToString();

                int   CurPage;
                if   (Request.QueryString[ "Page "]   !=   null)
                        CurPage   =   Convert.ToInt32(Request.QueryString[ "Page "]);


                else
                        CurPage   =   1;

                pds.CurrentPageIndex   =   CurPage   -   1;

                if   (!pds.IsFirstPage)
                        this.hyl_pre.NavigateUrl   =   Request.CurrentExecutionFilePath   +   "?Page= "   +   Convert.ToString(CurPage   -   1);

                if   (!pds.IsLastPage)
                        this.hyl_next.NavigateUrl   =   Request.CurrentExecutionFilePath   +   "?Page= "   +   Convert.ToString(CurPage   +   1);

                this.lbl_currentpage.Text   =   CurPage.ToString();

                this.dl2.DataSource   =   pds;
                this.dl2.DataBind();
        }
各位帮我看看,困惑许久。。。。。。。。。。。

[解决办法]
up~
[解决办法]
将 "Page "参数 分为 "dl1Page "和 "dl2Page "两个参数,分别去读取使用嘛!
[解决办法]
用两个参数也可以的

热点排行