PagedList-master/src/PagedList.Mvc/PagedListRenderOptions.cs
/// <summary>
/// Enables ASP.NET MVC's unobtrusive AJAX feature. An XHR request will retrieve HTML from the clicked page and replace the innerHtml of the provided element ID.
/// </summary>
/// <param name="options">The preferred Html.PagedList(...) style options.</param>
/// <param name="id">The element ID ("#my_id") of the element whose innerHtml should be replaced.</param>
/// <returns>The PagedListRenderOptions value passed in, with unobtrusive AJAX attributes added to the page links.</returns>
Enables ASP.NET MVC's unobtrusive AJAX feature. An XHR request will retrieve HTML from the clicked page and replace the innerHtml of the provided element ID.
Enables ASP . NET MVC ' s unobtrusive AJAX feature . An XHR request will retrieve HTML from the clicked page and replace the innerHtml of the provided element ID .
public static PagedListRenderOptions EnableUnobtrusiveAjaxReplacing(PagedListRenderOptions options, string id)
		{
			options.FunctionToTransformEachPageLink = (liTagBuilder, aTagBuilder) =>
			                                          	{
			                                          		var appendUnobtrusiveAjaxAttributes = true;
															if (liTagBuilder.Attributes.ContainsKey("class"))
															{
																var liClasses = liTagBuilder.Attributes["class"].Split(' ');
																appendUnobtrusiveAjaxAttributes = !liClasses.Contains("disabled") && !liClasses.Contains("active");
															}
															if (appendUnobtrusiveAjaxAttributes)
															{
																aTagBuilder.Attributes.Add("data-ajax", "true");
																aTagBuilder.Attributes.Add("data-ajax-method", "get");
																aTagBuilder.Attributes.Add("data-ajax-mode", "replace");
																aTagBuilder.Attributes.Add("data-ajax-update", id);																
															}
															liTagBuilder.InnerHtml = aTagBuilder.ToString();
			                                          		return liTagBuilder;
			                                          	};
			return options;
		}
public static PagedListRenderOptions EnableUnobtrusiveAjaxReplacing ( PagedListRenderOptions options , string id ) { options . FunctionToTransformEachPageLink = ( liTagBuilder , aTagBuilder ) => { var appendUnobtrusiveAjaxAttributes = true ; if ( liTagBuilder . Attributes . ContainsKey ( " " ) ) { var liClasses = liTagBuilder . Attributes [ " " ] . Split ( ' ' ) ; appendUnobtrusiveAjaxAttributes = ! liClasses . Contains ( " " ) && ! liClasses . Contains ( " " ) ; } if ( appendUnobtrusiveAjaxAttributes ) { aTagBuilder . Attributes . Add ( " " , " " ) ; aTagBuilder . Attributes . Add ( " " , " " ) ; aTagBuilder . Attributes . Add ( " " , " " ) ; aTagBuilder . Attributes . Add ( " " , id ) ; } liTagBuilder . InnerHtml = aTagBuilder . ToString ( ) ; return liTagBuilder ; } ; return options ; }
Enables ASP.NET MVC's unobtrusive AJAX feature.
Enables ASP . NET MVC ' s unobtrusive AJAX feature .
The PagedListRenderOptions value passed in, with unobtrusive AJAX attributes added to the page links.
The PagedListRenderOptions value passed in with unobtrusive AJAX attributes added to the page links .
options
PagedListRenderOptions
The preferred Html.PagedList(...) style options.
The preferred Html . PagedList ( ... ) style options .
id
string
The element ID ("#my_id") of the element whose innerHtml should be replaced.
The element ID ( " #my_id " ) of the element whose innerHtml should be replaced .