Pages/MVCPager/PagerBuilder.cs
(开头部分) 29KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Globalization;
using System.Web;
using System.Web.Mvc.Ajax;
using System.Web.Routing;
using System.Web.Mvc;
using System.Text;
using System.Collections.Generic;
namespace MVC
{
internal class PagerBuilder
{
private readonly HtmlHelper _html;
private readonly AjaxHelper _ajax;
private readonly string _actionName;
private readonly string _controllerName;
private readonly int _totalPageCount = 1;
private readonly int _pageIndex;
private readonly PagerOptions _pagerOptions;
private readonly RouteValueDictionary _routeValues;
private readonly string _routeName;
private readonly int _startPageIndex = 1;
private readonly int _endPageIndex = 1;
private readonly bool _msAjaxPaging;
private readonly AjaxOptions _ajaxOptions;
private IDictionary<string, object> _htmlAttributes;
private const string CopyrightText = "\r\n<!--Conris-->\r\n";
private const string JqueryScriptCheckItemKey = "_MvcPager_CheckjQueryScript";
private const string ScriptPageIndexName = "*_MvcPager_PageIndex_*";
private const string JqCheckScript = "if(typeof(jQuery)==\"undefined\"){alert(\"jQuery library not detected, please make sure it loaded prior to MvcPager!\");}";
private const string GoToPageScript = "function _MvcPager_GoToPage(_pib,_mp){var pageIndex;if(_pib.tagName==\"SELECT\"){pageIndex=_pib.options[_pib.selectedIndex].value;}else{pageIndex=_pib.value;var r=new RegExp(\"^\\\\s*(\\\\d+)\\\\s*$\");if(!r.test(pageIndex)){alert(\"%InvalidPageIndexErrorMessage%\");return;}else if(RegExp.$1<1||RegExp.$1>_mp){alert(\"%PageIndexOutOfRangeErrorMessage%\");return;}}var _hl=document.getElementById(_pib.id+'link').childNodes[0];var _lh=_hl.href;_hl.href=_lh.replace('" + ScriptPageIndexName + "',pageIndex);%ClickHandler%;_hl.href=_lh;}";
private const string KeyDownScript = "function _MvcPager_Keydown(e){var _kc,_pib;if(window.event){_kc=e.keyCode;_pib=e.srcElement;}else if(e.which){_kc=e.which;_pib=e.target;}var validKey=(_kc==8||_kc==46||_kc==37||_kc==39||(_kc>=48&&_kc<=57)||(_kc>=96&&_kc<=105));if(!validKey){if(_kc==13){ _MvcPager_GoToPage(_pib,%TotalPageCount%);}if(e.preventDefault){e.preventDefault();}else{event.returnValue=false;}}}";
/// <summary>
/// used when PagedList is null
/// </summary>
internal PagerBuilder(HtmlHelper html, AjaxHelper ajax, PagerOptions pagerOptions, IDictionary<string, object> htmlAttributes)
{
if (pagerOptions == null)
pagerOptions = new PagerOptions();
_html = html;
_ajax = ajax;
_pagerOptions = pagerOptions;
_htmlAttributes = htmlAttributes;
}
internal PagerBuilder(HtmlHelper html, AjaxHelper ajax, string actionName, string controllerName,
int totalPageCount, int pageIndex, PagerOptions pagerOptions, string routeName, RouteValueDictionary routeValues,
AjaxOptions ajaxOptions, IDictionary<string, object> htmlAttributes)
{
_msAjaxPaging = (ajax != null);
if (String.IsNullOrEmpty(actionName))
{
if (routeValues != null && routeValues["action"] != null)
{
actionName = routeValues["action"].ToString();
html.ViewContext.RouteData.Values["action"] = actionName;
}
else
后面还有 520 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读 AI
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
