If you are using SubSonic, you probably using paging mechanism that is explained in this webcast by Rob Conery. That is a very cast but I think the code has a problem with button enables/disables when data fits into only one page. So I think this problem can be solved by changing ResolvePagerView method with the following code. Also SetupPaging() must be called before LoadGrid(1) in Page_Load method.s
void ResolvePagerView(int currentPage)
{
int pageCount = 1;
try
{
pageCount = int.Parse(lblPageCount.Text);
}
catch (Exception) { }
int nextPage = currentPage + 1;
int prevPage = currentPage - 1;
btnPrev.Enabled = true;
btnNext.Enabled = true;
btnLast.Enabled = true;
btnFirst.Enabled = true;
if (currentPage == pageCount)
{
btnNext.Enabled = false;
btnLast.Enabled = false;
}
if (currentPage == 1)
{
btnPrev.Enabled = false;
btnFirst.Enabled = false;
}
}
No comments:
Post a Comment