您的位置首页生活百科

repeater怎么分页?

repeater怎么分页?

的有关信息介绍如下:

repeater怎么分页?

创建一个分页数据源的对象这样:protected PagedDataSource pds=new PagedDataSource();//这个放在Page_Load上面在绑定的时候这样写 pds.AllowPaging = true;//设置可以分页 pds.PageSize = 2;//每页的项数 pds.CurrentPageIndex = 0;//获取或设置当前页的索引 pds.DataSource = ds.Tables[0].DefaultView;//ds是从数据库获取的DataSet Repeater1.DataSource = pds;//绑定数据 Repeater1.DataBind();然后在添加一些button控件来做上一页,下一页这些希望对你有用