Edit

Share via


ScriptManager.RegisterArrayDeclaration Method

Definition

Registers an ECMAScript (JavaScript) array declaration with the ScriptManager control for use with a control that is inside an UpdatePanel control, and adds the array to the page.

Overloads

RegisterArrayDeclaration(Control, String, String)

Registers an ECMAScript (JavaScript) array declaration with the ScriptManager control for use with a control that is inside an UpdatePanel control, and adds the array to the page.

RegisterArrayDeclaration(Page, String, String)

Registers an ECMAScript (JavaScript) array declaration with the ScriptManager control for use with a control that is inside an UpdatePanel control, and adds the array to the page.

RegisterArrayDeclaration(Control, String, String)

Registers an ECMAScript (JavaScript) array declaration with the ScriptManager control for use with a control that is inside an UpdatePanel control, and adds the array to the page.

public:
 static void RegisterArrayDeclaration(System::Web::UI::Control ^ control, System::String ^ arrayName, System::String ^ arrayValue);
public static void RegisterArrayDeclaration (System.Web.UI.Control control, string arrayName, string arrayValue);
static member RegisterArrayDeclaration : System.Web.UI.Control * string * string -> unit
Public Shared Sub RegisterArrayDeclaration (control As Control, arrayName As String, arrayValue As String)

Parameters

control
Control

The control that is registering the array.

arrayName
String

The name of the array to register.

arrayValue
String

The array value or values to register.

Exceptions

arrayName is null.

Remarks

You use the RegisterArrayDeclaration method to register a client script array that is compatible with partial-page rendering and that has no Microsoft Ajax Library dependencies. This method registers the array when control represents a control that is inside an UpdatePanel control that is being updated. To register an array every time that an asynchronous postback occurs, use the RegisterArrayDeclaration(Page, String, String) overload of this method.

If you want to register an array that does not pertain to partial-page updates, and if you want to register the array only one time during initial page rendering, use the RegisterArrayDeclaration method of the ClientScriptManager class. You can get a reference to the ClientScriptManager object from the ClientScript property of the page.

The RegisterArrayDeclaration method determines whether an array with the name that is specified in the arrayName parameter is already registered. If so, the method adds the values specified in arrayValue. Because the array to be registered is based on the ArrayList class, duplicates are allowed. If a registered array with the name in arrayName does not exist, the array is created and the values in arrayValue are added to it.

To include string literals in the array, use single quotation marks (') or escaped double quotation marks (\") in arrayValue.

Note that JavaScript treats a comma (,) as a delimiter in an array. You can specify multiple array values by passing a comma-delimited string in arrayValue. Separating two items with a comma in arrayValue is equivalent to calling the RegisterArrayDeclaration method two times, one time for each item.

See also

Applies to

RegisterArrayDeclaration(Page, String, String)

Registers an ECMAScript (JavaScript) array declaration with the ScriptManager control for use with a control that is inside an UpdatePanel control, and adds the array to the page.

public:
 static void RegisterArrayDeclaration(System::Web::UI::Page ^ page, System::String ^ arrayName, System::String ^ arrayValue);
public static void RegisterArrayDeclaration (System.Web.UI.Page page, string arrayName, string arrayValue);
static member RegisterArrayDeclaration : System.Web.UI.Page * string * string -> unit
Public Shared Sub RegisterArrayDeclaration (page As Page, arrayName As String, arrayValue As String)

Parameters

page
Page

The page object that is registering the array.

arrayName
String

The name of the array to register.

arrayValue
String

The array value or values to register.

Exceptions

arrayName is null.

Remarks

You use the RegisterArrayDeclaration method to register a client script array that is compatible with partial-page rendering and that has no Microsoft Ajax Library dependencies. This method registers the array every time that an asynchronous postback occurs. To register an array for a control that is inside an UpdatePanel control so that the array is registered only when the panel is updated, use the RegisterArrayDeclaration(Control, String, String) overload of this method.

If you want to register an array that does not pertain to partial-page updates, and if you want to register the array only one time during initial page rendering, use the RegisterArrayDeclaration method of the ClientScriptManager class. You can get a reference to the ClientScriptManager object from the ClientScript property of the page.

See also

Applies to