private string GenerateAnchor(PagerItem item) { if (_msAjaxPaging) { var routeValues = GetCurrentRouteValues(_ajax.ViewContext); if (item.PageIndex == 0) { routeValues[_pagerOptions.PageIndexParameterName] = ScriptPageIndexName; } else { routeValues[_pagerOptions.PageIndexParameterName] = item.PageIndex; } if (!string.IsNullOrEmpty(_routeName)) { return(_ajax.RouteLink(item.Text, _routeName, routeValues, _ajaxOptions).ToString()); } return(_ajax.RouteLink(item.Text, routeValues, _ajaxOptions).ToString()); } string url = GenerateUrl(item.PageIndex); if (_pagerOptions.UseJqueryAjax) { StringBuilder ehBuilder = new StringBuilder(); //ignore OnSuccess property if (!string.IsNullOrEmpty(_ajaxOptions.OnFailure) || !string.IsNullOrEmpty(_ajaxOptions.OnBegin)) { ehBuilder.Append("$.ajax({url:$(this).attr(\'href\'),success:function(data,status,xhr){$(\'#"); ehBuilder.Append(_ajaxOptions.UpdateTargetId).Append("\').html(data);}"); if (!string.IsNullOrEmpty(_ajaxOptions.OnFailure)) { ehBuilder.Append(",error:").Append(HttpUtility.HtmlAttributeEncode(_ajaxOptions.OnFailure)); } if (!string.IsNullOrEmpty(_ajaxOptions.OnBegin)) { ehBuilder.Append(",beforeSend:").Append(HttpUtility.HtmlAttributeEncode(_ajaxOptions.OnBegin)); } if (!string.IsNullOrEmpty(_ajaxOptions.OnComplete)) { ehBuilder.Append(",complete:").Append( HttpUtility.HtmlAttributeEncode(_ajaxOptions.OnComplete)); } ehBuilder.Append("});return false;"); } else { ehBuilder.Append("$(\'#").Append(_ajaxOptions.UpdateTargetId); ehBuilder.Append("\').load($(this).attr(\'href\')"); if (!string.IsNullOrEmpty(_ajaxOptions.OnComplete)) { ehBuilder.Append(",").Append(HttpUtility.HtmlAttributeEncode(_ajaxOptions.OnComplete)); } ehBuilder.Append(");return false;"); } return(string.IsNullOrEmpty(url) ? _html.Encode(item.Text) : String.Format(CultureInfo.InvariantCulture, "<a href=\"{0}\" onclick=\"{1}\">{2}</a>", GenerateUrl(item.PageIndex), ehBuilder, item.Text)); } return("<a href=\"" + url + "\" onclick=\"window.open(this.attributes.getNamedItem('href').value,'_self')\"></a>"); }