private string GenerateAnchor(PagerItem item) { if (_msAjaxPaging) { RouteValueDictionary currentRouteValues = GetCurrentRouteValues(_ajax.ViewContext); if (item.PageIndex == 0) { currentRouteValues[_pagerOptions.PageIndexParameterName] = "*_MvcPager_PageIndex_*"; } else { currentRouteValues[_pagerOptions.PageIndexParameterName] = item.PageIndex; } if (!string.IsNullOrEmpty(_routeName)) { return(_ajax.RouteLink(item.Text, _routeName, currentRouteValues, _ajaxOptions).ToString()); } return(_ajax.RouteLink(item.Text, currentRouteValues, _ajaxOptions).ToString()); } string str = GenerateUrl(item.PageIndex); if (!_pagerOptions.UseJqueryAjax) { return("<a href=\"" + str + "\" onclick=\"window.open(this.attributes.getNamedItem('href').value,'_self')\"></a>"); } if (_html.ViewContext.UnobtrusiveJavaScriptEnabled) { TagBuilder builder = new TagBuilder("a") { InnerHtml = item.Text }; builder.MergeAttribute("href", str); builder.MergeAttribute("p", item.PageIndex.ToString()); builder.MergeAttributes(_ajaxOptions.ToUnobtrusiveHtmlAttributes()); if (!string.IsNullOrEmpty(str)) { return(builder.ToString(TagRenderMode.Normal)); } return(_html.Encode(item.Text)); } StringBuilder builder3 = new StringBuilder(); if ((!string.IsNullOrEmpty(_ajaxOptions.OnFailure) || !string.IsNullOrEmpty(_ajaxOptions.OnBegin)) || (!string.IsNullOrEmpty(_ajaxOptions.OnComplete) && (_ajaxOptions.HttpMethod.ToUpper() != "GET"))) { builder3.Append("$.ajax({type:'").Append((_ajaxOptions.HttpMethod.ToUpper() == "GET") ? "get" : "post"); builder3.Append("',url:$(this).attr('href'),success:function(data,status,xhr){$('#"); builder3.Append(_ajaxOptions.UpdateTargetId).Append("').html(data);}"); if (!string.IsNullOrEmpty(_ajaxOptions.OnFailure)) { builder3.Append(",error:").Append(HttpUtility.HtmlAttributeEncode(_ajaxOptions.OnFailure)); } if (!string.IsNullOrEmpty(_ajaxOptions.OnBegin)) { builder3.Append(",beforeSend:").Append(HttpUtility.HtmlAttributeEncode(_ajaxOptions.OnBegin)); } if (!string.IsNullOrEmpty(_ajaxOptions.OnComplete)) { builder3.Append(",complete:").Append(HttpUtility.HtmlAttributeEncode(_ajaxOptions.OnComplete)); } builder3.Append("});return false;"); } else if (_ajaxOptions.HttpMethod.ToUpper() == "GET") { builder3.Append("$('#").Append(_ajaxOptions.UpdateTargetId); builder3.Append("').load($(this).attr('href')"); if (!string.IsNullOrEmpty(_ajaxOptions.OnComplete)) { builder3.Append(",").Append(HttpUtility.HtmlAttributeEncode(_ajaxOptions.OnComplete)); } builder3.Append(");return false;"); } else { builder3.Append("$.post($(this).attr('href'), function(data) {$('#"); builder3.Append(_ajaxOptions.UpdateTargetId); builder3.Append("').html(data);});return false;"); } if (!string.IsNullOrEmpty(str)) { return(string.Format(CultureInfo.InvariantCulture, "<a href=\"{0}\" onclick=\"{1}\">{2}</a>", str, builder3, item.Text)); } return(_html.Encode(item.Text)); }