分页控件

1.下载控件添加  http://www.webdiyer.com/Controls/AspNetPager/Downloads

2.   书写代码

     protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        bind_grid(AspNetPager1.CurrentPageIndex);
    }

   

   public void bind_grid(int pageindex)  

   {             

           string tbl_name = "View_Order_select";        

              int pagesize = 10;

               int docount = 0;

              int ordertype =1;                  

       string str_where =" 1=1 "+ lbMessage.Text;

              int count = osDate.getOrderCount(str_where);    

          lbOrderCount.Text = count.ToString();  

                  this.AspNetPager1.RecordCount = count;   

                 PagedDataSource pds = new PagedDataSource();   

                pds.AllowPaging = true;         pds.PageSize = AspNetPager1.PageSize;     

                pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;

               //调用分页存储过程       

               DataSet ds = co.GetCustomersData_shop(tbl_name, "*", "id", pagesize, pageindex, docount, ordertype, str_where);

                 pds.DataSource = ds.Tables[0].DefaultView;

               DataTable orderDate = this.getZHOrderState(ds.Tables[0]);  

               ASPxGridView1.DataSource =orderDate;    
              ASPxGridView1.DataBind();         

    }

 

3.分页控件见本地资料,sql创建

 

 

 

 

 

 

 

posted @ 2013-06-17 11:15  阿玉儿  阅读(171)  评论(0)    收藏  举报