AjaxOptions Class

 

Represents option settings for running Ajax scripts in an ASP.NET MVC application.

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

Inheritance Hierarchy

System.Object
  System.Web.Mvc.Ajax.AjaxOptions

Syntax

public class AjaxOptions
public ref class AjaxOptions 
type AjaxOptions = class end
Public Class AjaxOptions

Constructors

Name Description
System_CAPS_pubmethod AjaxOptions()

Initializes a new instance of the AjaxOptions class.

Properties

Name Description
System_CAPS_pubproperty AllowCache

System_CAPS_pubproperty Confirm

Gets or sets the message to display in a confirmation window before a request is submitted.

System_CAPS_pubproperty HttpMethod

Gets or sets the HTTP request method ("Get" or "Post").

System_CAPS_pubproperty InsertionMode

Gets or sets the mode that specifies how to insert the response into the target DOM element.

System_CAPS_pubproperty LoadingElementDuration

Gets or sets a value, in milliseconds, that controls the duration of the animation when showing or hiding the loading element.

System_CAPS_pubproperty LoadingElementId

Gets or sets the id attribute of an HTML element that is displayed while the Ajax function is loading.

System_CAPS_pubproperty OnBegin

Gets or sets the name of the JavaScript function to call immediately before the page is updated.

System_CAPS_pubproperty OnComplete

Gets or sets the JavaScript function to call when response data has been instantiated but before the page is updated.

System_CAPS_pubproperty OnFailure

Gets or sets the JavaScript function to call if the page update fails.

System_CAPS_pubproperty OnSuccess

Gets or sets the JavaScript function to call after the page is successfully updated.

System_CAPS_pubproperty UpdateTargetId

Gets or sets the ID of the DOM element to update by using the response from the server.

System_CAPS_pubproperty Url

Gets or sets the URL to make the request to.

Methods

Name Description
System_CAPS_pubmethod Equals(Object)

(Inherited from Object.)

System_CAPS_protmethod Finalize()

(Inherited from Object.)

System_CAPS_pubmethod GetHashCode()

(Inherited from Object.)

System_CAPS_pubmethod GetType()

(Inherited from Object.)

System_CAPS_protmethod MemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethod ToString()

(Inherited from Object.)

System_CAPS_pubmethod ToUnobtrusiveHtmlAttributes()

Returns the Ajax options as a collection of HTML attributes to support unobtrusive JavaScript.

Remarks

This class provides options for methods of the AjaxHelper and AjaxExtensions classes.

Examples

The following example shows how to use the AjaxOptions class to set the ID of the elements that are used to display the status message and to enter text.

<p>
    Page Rendered: @DateTime.Now.ToLongTimeString()
</p>
<span id="status">No Status</span>
<br />   
@Ajax.ActionLink("Update Status", "GetStatus", new AjaxOptions{UpdateTargetId="status" })
<br /><br />
@using(Ajax.BeginForm("UpdateForm", new AjaxOptions{UpdateTargetId="textEntered"})) 
{
  @Html.TextBox("textBox1","Enter text")  
  <input type="submit" value="Submit"/><br />
  <span id="textEntered">Nothing Entered</span>
}

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

System.Web.Mvc.Ajax Namespace

Return to top