Table of Contents

Class AjaxHelper

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

Represents support for rendering HTML in AJAX scenarios within a view.

public class AjaxHelper
Inheritance
AjaxHelper
Derived
Inherited Members
Extension Methods

Constructors

AjaxHelper(ViewContext, IViewDataContainer)

Initializes a new instance of the AjaxHelper class using the specified view context and view data container.

public AjaxHelper(ViewContext viewContext, IViewDataContainer viewDataContainer)

Parameters

viewContext ViewContext

The view context.

viewDataContainer IViewDataContainer

The view data container.

Exceptions

ArgumentNullException

One or both of the parameters is null.

AjaxHelper(ViewContext, IViewDataContainer, RouteCollection)

Initializes a new instance of the AjaxHelper class by using the specified view context, view data container, and route collection.

public AjaxHelper(ViewContext viewContext, IViewDataContainer viewDataContainer, RouteCollection routeCollection)

Parameters

viewContext ViewContext

The view context.

viewDataContainer IViewDataContainer

The view data container.

routeCollection RouteCollection

The URL route collection.

Exceptions

ArgumentNullException

One or more of the parameters is null.

Properties

GlobalizationScriptPath

Gets or sets the root path for the location to use for globalization script files.

public static string GlobalizationScriptPath { get; set; }

Property Value

string

The location of the folder where globalization script files are stored. The default location is "~/Scripts/Globalization".

RouteCollection

Gets the collection of URL routes for the application.

public RouteCollection RouteCollection { get; }

Property Value

RouteCollection

The collection of routes for the application.

ViewBag

Gets the ViewBag.

public dynamic ViewBag { get; }

Property Value

dynamic

The ViewBag.

ViewContext

Gets the context information about the view.

public ViewContext ViewContext { get; }

Property Value

ViewContext

The context of the view.

ViewData

Gets the current view data dictionary.

public ViewDataDictionary ViewData { get; }

Property Value

ViewDataDictionary

The view data dictionary.

ViewDataContainer

Gets the view data container.

public IViewDataContainer ViewDataContainer { get; }

Property Value

IViewDataContainer

The view data container.

Methods

JavaScriptStringEncode(string)

Serializes the specified message and returns the resulting JSON-formatted string.

public string JavaScriptStringEncode(string message)

Parameters

message string

The message to serialize.

Returns

string

The serialized message as a JSON-formatted string.