Export (0) Print
Expand All

ScriptManager::RegisterDataItem Method (Control, String)

Sends custom data to a control during partial-page rendering.

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

void RegisterDataItem(
	Control^ control, 
	String^ dataItem


Type: System.Web.UI::Control

The control that is receiving the data.

Type: System::String

The data that is sent to the control.


control is nullptr.


The RegisterDataItem method is called during a postback.


dataItem is already registered for control.

Use the RegisterDataItem method to send data from the server to the client during asynchronous postbacks, regardless of whether the control receiving the data is inside an UpdatePanel control.

The RegisterDataItem method can be called only during an asynchronous postback. To determine whether a postback is asynchronous, use the IsInAsyncPostBack property. This method invokes the overload that takes a parameter named isJsonSerialized that is set to false. When the isJsonSerialized parameter is set to false, the string is not serialized as JavaScript Object Notation (JSON). For more information about the JSON format, see the Introducing JSON Web site.

The data items that are registered with the RegisterDataItem method can be accessed in client script during the pageLoading, pageLoaded, and endRequest events of the PageRequestManager object. When you handle these events, the custom data is passed in an event argument object. For example, if you provide a handler for the pageLoading event, the custom data is passed in the PageLoadingEventArgs class, which exposes a dataItems property.

The following example shows how to send data to two Label controls on a page during an asynchronous postback. The Label controls are not inside an UpdatePanel control.


The data that is sent in this example is for illustration only. In a real-world application, you would use the RegisterDataItem method to send custom data from the server.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5, 4, 3.5

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

© 2014 Microsoft