repeater分页
//Repeater分页控制显示方法
public void contrlRepeater(int userId)
{
string connectionString = ConfigurationManager.ConnectionStrings["db_health"].ConnectionString;
SqlConnection conn = new SqlConnection(connectionString);
conn.Open();
string sql = "select * from health_user_followup_content where user_id=" + userId + "";
SqlDataAdapter sda = new SqlDataAdapter(sql,conn);
DataSet ds = new DataSet();
sda.Fill(ds,"FollowContent");
PagedDataSource pds = new PagedDataSource();
pds.DataSource = ds.Tables["FollowContent"].DefaultView;
pds.AllowPaging = true;
pds.PageSize = 5;
pds.CurrentPageIndex = Convert.ToInt32(this.labPage.Text) - 1;
rpUserList.DataSource = pds;
LabCountPage.Text = pds.PageCount.ToString();
labPage.Text = (pds.CurrentPageIndex + 1).ToString();
this.lbtnpritPage.Enabled = true;
this.lbtnFirstPage.Enabled = true;
this.lbtnNextPage.Enabled = true;
this.lbtnDownPage.Enabled = true;
if (pds.CurrentPageIndex < 1)
{
this.lbtnpritPage.Enabled = false;
this.lbtnFirstPage.Enabled = false;
}
if (pds.CurrentPageIndex == pds.PageCount - 1)
{
this.lbtnNextPage.Enabled = false;
this.lbtnDownPage.Enabled = false;
}
rpUserList.DataBind();
}
pds.CurrentPageIndex = Convert.ToInt32(this.labPage.Text) - 1;————刚点击进入页面时,为什么我这句会提示:”输入字符串的格式不正确”