1: public static class PagingHelpers
2: {
3: public static MvcHtmlString PageLinks(this HtmlHelper html,
4: PagingInfo pagingInfo, Func<int, string> pageUrl)
5: {
6: StringBuilder result = new StringBuilder();
7: for (int i = 1; i <= pagingInfo.TotalPages; i++)
8: {
9: TagBuilder tag = new TagBuilder("a");
10: tag.MergeAttribute("href", pageUrl(i));
11: tag.InnerHtml = i.ToString();
12: if (i == pagingInfo.CurrentPage)
13: tag.AddCssClass("selected");
14: result.Append(tag.ToString());
15:
16: }
17: return MvcHtmlString.Create(result.ToString());
18: }
19: }public static class PagingHelpers
20: {
21: public static MvcHtmlString PageLinks(this HtmlHelper html,
22: PagingInfo pagingInfo, Func<int, string> pageUrl)
23: {
24: StringBuilder result = new StringBuilder();
25: for (int i = 1; i <= pagingInfo.TotalPages; i++)
26: {
27: TagBuilder tag = new TagBuilder("a");
28: tag.MergeAttribute("href", pageUrl(i));
29: tag.InnerHtml = i.ToString();
30: if (i == pagingInfo.CurrentPage)
31: tag.AddCssClass("selected");
32: result.Append(tag.ToString());
33:
34: }
35: return MvcHtmlString.Create(result.ToString());
36: }
37: }