Demo
int pagetCount = Convert.ToInt32(this.Label1.Text);
SqlConnection con = DB.con;
SqlDataAdapter sda = new SqlDataAdapter();
DataSet ds = new DataSet();
PagedDataSource ps = new PagedDataSource();//可分页数据源
sda.SelectCommand = new SqlCommand("select top(90) * from books", con);
try
{
con.Open();
sda.Fill(ds, "books");
ps.DataSource = ds.Tables["books"].DefaultView;//初始化可分页数据源的数据源属性
ps.AllowPaging = true;//设置为可分页
ps.PageSize = 10;//设置每页显示多少行数据
ps.CurrentPageIndex = pagetCount - 1;//设置当前页
this.Button1.Enabled = true;
this.Button2.Enabled = true;
this.Repeater1.DataSource = ps;//用可分页数据源初始Repeater控件
this.Repeater1.DataBind(); //绑定
if (pagetCount==1)
{
this.Button1.Enabled = false;
}
if (pagetCount == ps.PageCount)
{
this.Button2.Enabled = false;
}