Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
RegisterArrayDeclaration Method (Control, String, String)

ScriptManager.RegisterArrayDeclaration Method (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.

Namespace:  System.Web.UI
Assembly:  System.Web.Extensions (in System.Web.Extensions.dll)

public static void RegisterArrayDeclaration(
	Control control,
	string arrayName,
	string arrayValue


Type: System.Web.UI.Control

The control that is registering the array.

Type: System.String

The name of the array to register.

Type: System.String

The array value or values to register.


arrayName is null.

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. Separating two items with a comma in arrayValue is equivalent to calling the RegisterArrayDeclaration method two times, one time for each item.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5

Community Additions

© 2015 Microsoft