/// <summary> /// 构造函数 /// </summary> /// <param name="text"></param> /// <param name="pageIndex"></param> /// <param name="disabled"></param> /// <param name="buttonType"></param> public PageButton(string text, int pageIndex, bool disabled, PageButtonType buttonType) { Text = text; PageIndex = pageIndex; Disabled = disabled; ButtonType = buttonType; }
public JPageButton() { buttonType = PageButtonType.None; this.BackColor = Color.Transparent; _isFoucs = false; this.MaximumSize = new Size(31, 31); this.MinimumSize = new Size(31, 31); _pageindex = "1"; this.Cursor = Cursors.Hand; }
private string getPageButtonClass(PageButtonType pageButtonType) { switch (pageButtonType) { case PageButtonType.First: return("PageButtonFirst"); case PageButtonType.Last: return("PageButtonLast"); case PageButtonType.Next: return("PageButtonNext"); case PageButtonType.Previous: return("PageButtonPrevious"); case PageButtonType.GoTo: return("PageButtonGoTo"); default: return(string.Empty);; } }
public MvcHtmlString PageButton(string textOrUrl, PageButtonType pageButtonType, PageButtonStyle pageButtonStyle = PageButtonStyle.Link, IDictionary <string, object> htmlAttributes = null, string disabledUrl = null) { if (string.IsNullOrWhiteSpace(textOrUrl)) { throw (new ArgumentNullException("textOrUrl")); } if (htmlAttributes == null) { htmlAttributes = new Dictionary <string, object>(); } return (MvcHtmlString.Create( RenderPageField() + RenderPageButton( textOrUrl, disabledUrl, 0, pageButtonStyle, pageButtonType, htmlAttributes))); }
public MvcHtmlString PageButton(string textOrUrl, PageButtonType pageButtonType, PageButtonStyle pageButtonStyle = PageButtonStyle.Link, IDictionary <string, object> htmlAttributes = null, string disabledTextOrUrl = null) { if (string.IsNullOrWhiteSpace(textOrUrl)) { throw (new ArgumentNullException("textOrUrl")); } if (htmlAttributes == null) { htmlAttributes = new Dictionary <string, object>(); } int page = -1; switch (pageButtonType) { case PageButtonType.First: page = 1; if (currPage <= 1) { htmlAttributes["disabled"] = "disabled"; if (disabledTextOrUrl != null) { textOrUrl = disabledTextOrUrl; } } break; case PageButtonType.Last: if (totPages != null && totPages.HasValue && totPages.Value > currPage) { page = totPages.Value; } else { htmlAttributes["disabled"] = "disabled"; if (disabledTextOrUrl != null) { textOrUrl = disabledTextOrUrl; } page = currPage; } break; case PageButtonType.Next: if (totPages != null && totPages.HasValue) { if (totPages > currPage) { page = currPage + 1; } else { page = currPage; htmlAttributes["disabled"] = "disabled"; if (disabledTextOrUrl != null) { textOrUrl = disabledTextOrUrl; } } } else { page = currPage + 1; } break; case PageButtonType.Previous: page = 1; if (currPage <= 1) { htmlAttributes["disabled"] = "disabled"; if (disabledTextOrUrl != null) { textOrUrl = disabledTextOrUrl; } } else { page = currPage - 1; } break; case PageButtonType.GoTo: page = -1; if (totPages.HasValue && totPages <= 1) { htmlAttributes["disabled"] = "disabled"; if (disabledTextOrUrl != null) { textOrUrl = disabledTextOrUrl; } } break; default: break; } return (MvcHtmlString.Create( RenderPageField() + RenderPageButton( getPageButtonClass(pageButtonType), textOrUrl, page, pageButtonStyle, htmlAttributes))); }