public void BindData()
        {
            int count = this.GridView1.PageCount;//h获取总页数在调试的时候
                                                         //count=1而this.GridView1.PageCount=4这是为什么呢
            
int current = this.GridView1.PageIndex;
            if (current ==0)
            {
               this.LbFirst.Enabled = false;
                this.LbLast.Enabled = false;
            }
            else
            {     
                this.LbFirst.Enabled = true;
                this.LbLast.Enabled = true; 
              
             
            }
            if (current == (count - 1))
            {
               this.LbNext.Enabled = false;
                this.LbEnd.Enabled = false;
            }
            else
            {
                 this.LbNext.Enabled = true;
                this.LbEnd.Enabled = true;
             
            }

解决方案 »

  1.   

    public void BindData() 
            { 
    Response.write("begin:"+this.GridView1.PageCount);
                int count = this.GridView1.PageCount;//h获取总页数在调试的时候 
    Response.write("count:"+count);

                                                             //count=1而this.GridView1.PageCount=4这是为什么呢 
                int current = this.GridView1.PageIndex; 
                if (current ==0) 
                { 
                   this.LbFirst.Enabled = false; 
                    this.LbLast.Enabled = false; 
                } 
                else 
                {      
                    this.LbFirst.Enabled = true; 
                    this.LbLast.Enabled = true;  
                   
                  
                } 
                if (current == (count - 1)) 
                { 
                   this.LbNext.Enabled = false; 
                    this.LbEnd.Enabled = false; 
                } 
                else 
                { 
                     this.LbNext.Enabled = true; 
                    this.LbEnd.Enabled = true; 
                  
                }
      

  2.   

    你把断点打到int current = this.GridView1.PageIndex; 这一行再运行看看count的值是否一致
      

  3.   

    你是说int count = 4这个付值会有错??不可能的.你再好好跟一下!