多次按下next按钮后调试信息总是如下,它可以从第1页到第2页但不能到第3页
最后我发现问题是
Session["jobsearch"] = js;
它已保存但下次我检索它时,它就像以前没有保存过一样
调试信息
before js.CurrentPageNo=1
after js.CurrentPageNo=2
js.StartIndex=13
js.PageSize=24
js.TotalPageFound=5
js.CurrentPageNo=2
rowPerPage=12
before js.CurrentPageNo=1
after js.CurrentPageNo=2
js.StartIndex=13
js.PageSize=24
js.TotalPageFound=5
js.CurrentPageNo=2
rowPerPage=12
js.StartIndex=13js.PageSize=24js.TotalPageFound=5js.CurrentPageNo=2rowPerPage=12
js.StartIndex=13js.PageSize=24js.TotalPageFound=5js.CurrentPageNo=2rowPerPage=12
js.StartIndex=13js.PageSize=24js.TotalPageFound=5js.CurrentPageNo=2rowPerPage=12
js.StartIndex=13js.PageSize=24js.TotalPageFound=5js.CurrentPageNo=2rowPerPage=12
下一个按钮代码
protected void btnNext_OnClick(object sender, EventArgs e)
{
if (Session["jobsearch"] != null)
{
JobSearch js = (JobSearch)Session["jobsearch"];
js.CurrentPageNo++;
js.StartIndex = js.StartIndex + rowPerPage;
js.PageSize = js.PageSize + rowPerPage;
Session["jobsearch"] = js;
if (jobResultsTable.DocumentContent.Contains("Jobs In Engineering"))
{
Session["jobsearch2"] = "Jobs In Engineering";
}
else
{
Session["jobsearch2"] = "Jobs In IT";
}
System.IO.File.AppendAllText(@"D:\Debug.txt", "js.StartIndex=" + js.StartIndex);
System.IO.File.AppendAllText(@"D:\Debug.txt", "js.PageSize=" + js.PageSize);
System.IO.File.AppendAllText(@"D:\Debug.txt", "js.TotalPageFound=" + js.TotalPageFound);
System.IO.File.AppendAllText(@"D:\Debug.txt", "js.CurrentPageNo=" + js.CurrentPageNo);
System.IO.File.AppendAllText(@"D:\Debug.txt", "rowPerPage=" + rowPerPage);
GetJobSearchBOResult(js.StartIndex, js.PageSize, js.JobType, js.JobCountry, js.Keywords);
ShowButton(js.CurrentPageNo, js.TotalPageFound);
ltrPageInfo.Text = "Page " + js.CurrentPageNo + " of " + js.TotalPageFound.ToString() + "<br/> Total Record(s) Found: " + TotalJobFound;
}
}