当前位置:编程学习 > C#/ASP.NET >>

索引 -5 不是为负数,就是大于行 是什么原因导致的??

 private void DatabindZWLL()
    {
        this.MultZPXX.ActiveViewIndex = 5;
        this.btnFirstZWLL.Enabled = true;
        this.btnPreZWLL.Enabled = true;
        this.btnNextZWLL.Enabled = true;
        this.btnLastZWLL.Enabled = true;
        //    int corId = ((Corporation)Session["Corporation"]).id;
        int cid = ((Users)Session["user"]).id;
        PagedDataSource pds = new PagedDataSource();
        //根据cor_id获得其发出的面试通知
        pds.DataSource = CorporationInfoManager.GetZWLL(cid).Tables[0].DefaultView;
        pds.AllowPaging = true;
        pds.PageSize = 5;
        pds.CurrentPageIndex = Pager;
        if (pds.IsFirstPage)
        {
            this.btnFirstZWLL.Enabled = false;
            this.btnPreZWLL.Enabled = false;
        }
        if (pds.IsLastPage)
        {
            this.btnNextZWLL.Enabled = false;
            this.btnLastZWLL.Enabled = false;
        }

        this.lstZWLL.DataSource = pds;
        this.lstZWLL.DataBind();// 报 这一行的错误~~~~
        ViewState["pageCount"] = pds.PageCount;

    } --------------------编程问答-------------------- 应该不是你说的那句话有问题,看看有索引的地方: pds.CurrentPageIndex = Pager; 
 
如果PDS没有数据,且PAGER>1,肯定会出现,所以,在使用索引前要判断一下. --------------------编程问答-------------------- 大哥 怎么判断啊?
我 新手·
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,