Prev | Current Page 824 | Next

Rob Cameron and Dale Michalk

"Pro ASP.NET 3.5 Server Controls and AJAX Components"

HorizontalAlign = HorizontalAlign.Center;
// add extra separation between page numbers
// if text only paging is used
if (style == ResultPagerLinkStyle.Text)
{
lit = new LiteralControl();
lit.Text = " ";
cell.Controls.Add(lit);
}
//For TextWithDHTML functionality, you can create a
//HighlightedLinkButton class similar to the
//HighlightedHyperlink created in chapter 9
//and render that instead of the basic LinkButton
CHAPTER 12 ?–  BUILDING A COMPLEX CONTROL 647
//based on the configured ResultPagerLinkStyle
LinkButton pageButton = new LinkButton();
pageButton.ID = "page" + pageNum.ToString() + "Button";
pageButton.Text = pageNum.ToString();
pageButton.CommandName = "Page";
pageButton.CommandArgument = pageNum.ToString();
pageButton.CausesValidation = true;
if (currentPage == true)
pageButton.ControlStyle.Font.Bold = true;
cell.Controls.Add(pageButton);
textRow.Cells.Add(cell);
}
Creating the Pager??™s Next Button
After we are done creating the page number links, we have code that is similar to the Previous
button code. However, this code creates the Next button with a call to CreatePagerNextButton:
// insert a next link if less than max number of pages
if (calculatedEndPage > endPage)
{
// insert Next text
CreatePagerNextButton(textRow, PagerLinkStyle, PageNumber + 1);
}
The code for CreatePagerNextButton is as follows:
private void CreatePagerNextButton(TableRow textRow,
ResultPagerLinkStyle style, int nextIndex)
{
TableCell cell = new TableCell();
LiteralControl lit;
cell = new TableCell();
// add extra separation between page numbers
// if text only paging is used
if (style == ResultPagerLinkStyle.


Pages:
812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836