private void WriteCell(StringBuilder sb, string pageText, string cssClass) { string linktext = pageText; string rel = null; bool createLink = true; if (pageText == PAGER_DOTS) { cssClass += " dots"; createLink = false; } else if (pageText == _prev) { cssClass += " prev"; rel = "prev"; pageText = PageCurrent.ToString(); } else if (pageText == _next) { cssClass += " next"; rel = "next"; pageText = (PageCurrent + 2).ToString(); } else if (pageText == (PageCurrent + 1).ToString()) { cssClass += " current"; createLink = false; } if (createLink) { sb.Append(@"<a href="""); sb.Append(HRef.Replace("page=-1", "page=" + pageText)); sb.Append(@""" title=""go to page "); sb.Append(pageText); sb.Append(@""""); if (rel != null) { sb.Append(@" rel=""" + rel + @""""); } sb.Append(">"); } sb.Append(@"<span class="""); sb.Append(cssClass); sb.Append(@""">"); sb.Append(linktext); sb.Append("</span>"); if (createLink) { sb.Append("</a>"); } sb.AppendLine(); }
public override string ToString() { if (PageCount == 1) { return(""); } var sb = new StringBuilder(512); sb.Append(@"<div class="""); sb.Append(CssClass); sb.Append(@""">"); foreach (int pageSize in PageSizes) { sb.Append(@"<a href="""); sb.Append(HRef.Replace("pagesize=-1", "pagesize=" + pageSize)); sb.Append(@""" title="""); sb.Append("show "); sb.Append(pageSize); sb.Append(@" items per page"""); if (pageSize == CurrentPageSize) { sb.Append(@" class=""current page-numbers"""); } else { sb.Append(@" class=""page-numbers"""); } sb.Append(">"); sb.Append(pageSize); sb.AppendLine("</a>"); } sb.AppendLine(@"<span class=""page-numbers desc"">per page</span>"); sb.Append("</div>"); return(sb.ToString()); }