aspnetpager 排序

 

        PagedDataSource pds = new PagedDataSource();
        //用表格视图作为PagedDataSource的数据源  
        DataView dv = allproducts.Tables[0].DefaultView;
        dv.Sort = "AutoID desc";
        pds.DataSource = dv;
        pds.AllowPaging = true;
       
        pds.PageSize = AspNetPager1.PageSize = 20;
          AspNetPager1.RecordCount = pds.DataSourceCount;
            //改变当前索引页号(相当重要)  
        pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
         //将pds绑定到Repeater控件上  

        DataList1.DataSource = pds;
        DataList1.DataBind();

你可能感兴趣的:(学习笔记)