我有一个转发器控件用于显示产品,我想使用分页在每个页面上使用分页显示某些产品,但是当数据集在第一页上显示数据并且我单击下一页时它显示设置页面验证错误= true请帮我这个
public partial class WebForm1 : System.Web.UI.Page
{
Database _db = DatabaseFactory.CreateDatabase();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
getdata();
}
else
{
getdata();
}
}
public void getdata()
{
DataSet ds = new DataSet();
DbCommand selectcmd = _db.GetStoredProcCommand("SHOPHIVESP");
ds = _db.ExecuteDataSet(selectcmd);
PagedDataSource Pds1 = new PagedDataSource();
Pds1.DataSource = ds.Tables[0].DefaultView;
Pds1.AllowPaging = true;
Pds1.PageSize = 30;
Pds1.CurrentPageIndex = CurrentPage;
lbl1.Text = "Showing Page: " + (CurrentPage + 1).ToString() + " of " + Pds1.PageCount.ToString();
btnPrevious.Enabled = !Pds1.IsFirstPage;
btnNext.Enabled = !Pds1.IsLastPage;
Repeater1.DataSource = Pds1;
Repeater1.DataBind();
}
public int CurrentPage
{
get
{
object s1 = this.ViewState["CurrentPage"];
if (s1 == null)
{
return 0;
}
else
{
return Convert.ToInt32(s1);
}
}
set { this.ViewState["CurrentPage"] = value; }
}
public void btnPrevious_Click(object sender, EventArgs e)
{
CurrentPage -= 1;
getdata();
}
public void btnNext_Click(object sender, EventArgs e)
{
CurrentPage += 1;
getdata();
}
}
please tell me where the problem is, it is the code in c# and just a repeater at front in asp.net help me with this,i am using a stored procedure to select name image price from DB