Table of Contents

Class AjaxOptions

Namespace
System.Web.Mvc.Ajax
Assembly
System.Web.Mvc.dll

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

public class AjaxOptions
Inheritance
AjaxOptions
Inherited Members

Constructors

AjaxOptions()

Initializes a new instance of the AjaxOptions class.

public AjaxOptions()

Properties

AllowCache

public bool AllowCache { get; set; }

Property Value

bool

Confirm

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

public string Confirm { get; set; }

Property Value

string

The message to display in a confirmation window.

HttpMethod

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

public string HttpMethod { get; set; }

Property Value

string

The HTTP request method. The default value is "Post".

InsertionMode

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

public InsertionMode InsertionMode { get; set; }

Property Value

InsertionMode

The insertion mode ("InsertAfter", "InsertBefore", or "Replace"). The default value is "Replace".

LoadingElementDuration

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

public int LoadingElementDuration { get; set; }

Property Value

int

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

LoadingElementId

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

public string LoadingElementId { get; set; }

Property Value

string

The ID of the element that is displayed while the Ajax function is loading.

OnBegin

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

public string OnBegin { get; set; }

Property Value

string

The name of the JavaScript function to call before the page is updated.

OnComplete

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

public string OnComplete { get; set; }

Property Value

string

The JavaScript function to call when the response data has been instantiated.

OnFailure

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

public string OnFailure { get; set; }

Property Value

string

The JavaScript function to call if the page update fails.

OnSuccess

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

public string OnSuccess { get; set; }

Property Value

string

The JavaScript function to call after the page is successfully updated.

UpdateTargetId

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

public string UpdateTargetId { get; set; }

Property Value

string

The ID of the DOM element to update.

Url

Gets or sets the URL to make the request to.

public string Url { get; set; }

Property Value

string

The URL to make the request to.

Methods

ToUnobtrusiveHtmlAttributes()

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

public IDictionary<string, object> ToUnobtrusiveHtmlAttributes()

Returns

IDictionary<string, object>

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