现在的位置: 首页 > 综合 > 正文

PagedDataSource 分页

2012年05月19日 ⁄ 综合 ⁄ 共 371字 ⁄ 字号 评论关闭
DataSoure:数据源
AllowPageing:是否允许分页
PageSize:页面记录数
CurrentPageIndex:当前页面
public PagedDataSource pds(int pg)  //根据一个传来的整数作为当前页码并返回分页后的数据源
    {
        PagedDataSource pds 
= new PagedDataSource();
        pds.DataSource 
= dt("select * from authors").DefaultView;
        pds.AllowPaging
=true;
        pds.PageSize 
= pagesize;
        pds.CurrentPageIndex 
= pg;
        
return pds;
    }

抱歉!评论已关闭.