AjaxExtensions Class

Represents support for ASP.NET AJAX within an ASP.NET MVC application.

Inheritance Hierarchy

System.Object
  System.Web.Mvc.Ajax.AjaxExtensions

Namespace:  System.Web.Mvc.Ajax
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

Syntax

'Declaration
<ExtensionAttribute> _
Public NotInheritable Class AjaxExtensions
'Usage
public static class AjaxExtensions
[ExtensionAttribute]
public ref class AjaxExtensions abstract sealed
[<AbstractClassAttribute>]
[<SealedAttribute>]
type AjaxExtensions =  class end
public final class AjaxExtensions

Methods

  Name Description
Public methodStatic member ActionLink(AjaxHelper, String, String, AjaxOptions) Returns an anchor element that contains the URL to the specified action method; when the action link is clicked, the action method is invoked asynchronously by using JavaScript.
Public methodStatic member ActionLink(AjaxHelper, String, String, Object, AjaxOptions) Returns an anchor element that contains the URL to the specified action method; when the action link is clicked, the action method is invoked asynchronously by using JavaScript.
Public methodStatic member ActionLink(AjaxHelper, String, String, String, AjaxOptions) Returns an anchor element that contains the URL to the specified action method; when the action link is clicked, the action method is invoked asynchronously by using JavaScript.
Public methodStatic member ActionLink(AjaxHelper, String, String, RouteValueDictionary, AjaxOptions) Returns an anchor element that contains the URL to the specified action method; when the action link is clicked, the action method is invoked asynchronously by using JavaScript.
Public methodStatic member ActionLink(AjaxHelper, String, String, Object, AjaxOptions, Object) Returns an anchor element that contains the URL to the specified action method; when the action link is clicked, the action method is invoked asynchronously by using JavaScript.
Public methodStatic member ActionLink(AjaxHelper, String, String, String, Object, AjaxOptions) Returns an anchor element that contains the URL to the specified action method; when the action link is clicked, the action method is invoked asynchronously by using JavaScript.
Public methodStatic member ActionLink(AjaxHelper, String, String, String, RouteValueDictionary, AjaxOptions) Returns an anchor element that contains the URL to the specified action method; when the action link is clicked, the action method is invoked asynchronously by using JavaScript.
Public methodStatic member ActionLink(AjaxHelper, String, String, RouteValueDictionary, AjaxOptions, IDictionary<String, Object>) Returns an anchor element that contains the URL to the specified action method; when the action link is clicked, the action method is invoked asynchronously by using JavaScript.
Public methodStatic member ActionLink(AjaxHelper, String, String, String, Object, AjaxOptions, Object) Returns an anchor element that contains the URL to the specified action method; when the action link is clicked, the action method is invoked asynchronously by using JavaScript.
Public methodStatic member ActionLink(AjaxHelper, String, String, String, RouteValueDictionary, AjaxOptions, IDictionary<String, Object>) Returns an anchor element that contains the URL to the specified action method; when the action link is clicked, the action method is invoked asynchronously by using JavaScript.
Public methodStatic member ActionLink(AjaxHelper, String, String, String, String, String, String, Object, AjaxOptions, Object) Returns an anchor element that contains the URL to the specified action method; when the action link is clicked, the action method is invoked asynchronously by using JavaScript.
Public methodStatic member ActionLink(AjaxHelper, String, String, String, String, String, String, RouteValueDictionary, AjaxOptions, IDictionary<String, Object>) Returns an anchor element that contains the URL to the specified action method; when the action link is clicked, the action method is invoked asynchronously by using JavaScript.
Public methodStatic member BeginForm(AjaxHelper, AjaxOptions) Writes an opening <form> tag to the response.
Public methodStatic member BeginForm(AjaxHelper, String, AjaxOptions) Writes an opening <form> tag to the response.
Public methodStatic member BeginForm(AjaxHelper, String, Object, AjaxOptions) Writes an opening <form> tag to the response.
Public methodStatic member BeginForm(AjaxHelper, String, String, AjaxOptions) Writes an opening <form> tag to the response.
Public methodStatic member BeginForm(AjaxHelper, String, RouteValueDictionary, AjaxOptions) Writes an opening <form> tag to the response.
Public methodStatic member BeginForm(AjaxHelper, String, Object, AjaxOptions, Object) Writes an opening <form> tag to the response.
Public methodStatic member BeginForm(AjaxHelper, String, String, Object, AjaxOptions) Writes an opening <form> tag to the response.
Public methodStatic member BeginForm(AjaxHelper, String, String, RouteValueDictionary, AjaxOptions) Writes an opening <form> tag to the response.
Public methodStatic member BeginForm(AjaxHelper, String, RouteValueDictionary, AjaxOptions, IDictionary<String, Object>) Writes an opening <form> tag to the response.
Public methodStatic member BeginForm(AjaxHelper, String, String, Object, AjaxOptions, Object) Writes an opening <form> tag to the response.
Public methodStatic member BeginForm(AjaxHelper, String, String, RouteValueDictionary, AjaxOptions, IDictionary<String, Object>) Writes an opening <form> tag to the response.
Public methodStatic member BeginRouteForm(AjaxHelper, String, AjaxOptions) Writes an opening <form> tag to the response using the specified routing information.
Public methodStatic member BeginRouteForm(AjaxHelper, String, Object, AjaxOptions) Writes an opening <form> tag to the response using the specified routing information.
Public methodStatic member BeginRouteForm(AjaxHelper, String, RouteValueDictionary, AjaxOptions) Writes an opening <form> tag to the response using the specified routing information.
Public methodStatic member BeginRouteForm(AjaxHelper, String, Object, AjaxOptions, Object) Writes an opening <form> tag to the response using the specified routing information.
Public methodStatic member BeginRouteForm(AjaxHelper, String, RouteValueDictionary, AjaxOptions, IDictionary<String, Object>) Writes an opening <form> tag to the response using the specified routing information.
Public methodStatic member GlobalizationScript(AjaxHelper) Returns an HTML script element that contains a reference to a globalization script that defines the culture information.
Public methodStatic member GlobalizationScript(AjaxHelper, CultureInfo) Returns an HTML script element that contains a reference to a globalization script that defines the specified culture information.
Public methodStatic member RouteLink(AjaxHelper, String, Object, AjaxOptions) Returns an anchor element that contains the virtual path for the specified route values; when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript.
Public methodStatic member RouteLink(AjaxHelper, String, String, AjaxOptions) Returns an anchor element that contains the virtual path for the specified route values; when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript.
Public methodStatic member RouteLink(AjaxHelper, String, RouteValueDictionary, AjaxOptions) Returns an anchor element that contains the virtual path for the specified route values; when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript.
Public methodStatic member RouteLink(AjaxHelper, String, Object, AjaxOptions, Object) Returns an anchor element that contains the virtual path for the specified route values; when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript.
Public methodStatic member RouteLink(AjaxHelper, String, String, Object, AjaxOptions) Returns an anchor element that contains the virtual path for the specified route values; when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript.
Public methodStatic member RouteLink(AjaxHelper, String, String, AjaxOptions, IDictionary<String, Object>) Returns an anchor element that contains the virtual path for the specified route values; when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript.
Public methodStatic member RouteLink(AjaxHelper, String, String, AjaxOptions, Object) Returns an anchor element that contains the virtual path for the specified route values; when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript.
Public methodStatic member RouteLink(AjaxHelper, String, String, RouteValueDictionary, AjaxOptions) Returns an anchor element that contains the virtual path for the specified route values; when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript.
Public methodStatic member RouteLink(AjaxHelper, String, RouteValueDictionary, AjaxOptions, IDictionary<String, Object>) Returns an anchor element that contains the virtual path for the specified route values; when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript.
Public methodStatic member RouteLink(AjaxHelper, String, String, Object, AjaxOptions, Object) Returns an anchor element that contains the virtual path for the specified route values; when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript.
Public methodStatic member RouteLink(AjaxHelper, String, String, RouteValueDictionary, AjaxOptions, IDictionary<String, Object>) Returns an anchor element that contains the virtual path for the specified route values; when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript.
Public methodStatic member RouteLink(AjaxHelper, String, String, String, String, String, RouteValueDictionary, AjaxOptions, IDictionary<String, Object>) Returns an anchor element that contains the virtual path for the specified route values; when the link is clicked, a request is made to the virtual path asynchronously by using JavaScript.

Top

Remarks

The AjaxExtensions class contains methods that extend the AjaxHelper class. Each extension method renders an HTML element. The ActionLink method renders an anchor (a) element that links to an action method. The RouteLink method renders an anchor (a) element that links to a URL, which can resolve to an action method, a file, a folder, or some other resource. This class also contains BeginForm and BeginRouteForm methods that help you create HTML forms that are supported by AJAX functions.

Examples

The following example shows a view that calls the ActionLink method, the BeginRouteForm method, the BeginForm method, and the BeginRouteForm method. The ActionLink method links to an action method that updates a status message that contains a time stamp. The RouteLink method links to the same action method and updates a second status message. The BeginForm method creates a form that contains a text box where the user can enter a message that is displayed with the time the message was entered. The BeginRouteForm method creates a second form that also contains a text box for entering a message.

To support AJAX in the view, the following script references must be added to the master view.

<script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>

The following example shows the HomeController class that supports the view that is listed in the previous example. The GetStatus method is called by both the ActionLink and RouteLink methods and returns a status string. The UpdateForm method is called when the form created by BeginForm is submitted. This method returns a message to be displayed. The UpdateRouteForm method is called when the form that is created by BeginRouteForm is submitted. This method also returns a message to display.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

System.Web.Mvc.Ajax Namespace