Export (0) Print
Expand All

ScriptManager::RegisterHiddenField Method (Control, String, String)

Registers a hidden field with the ScriptManager control for a control that is inside an UpdatePanel control.

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

static void RegisterHiddenField(
	Control^ control, 
	String^ hiddenFieldName, 
	String^ hiddenFieldInitialValue


Type: System.Web.UI::Control

The control that is registering the hidden field.

Type: System::String

The name of the hidden field to register.

Type: System::String

The initial value of the hidden field.


control is nullptr.

- or -

hiddenFieldName is nullptr.


control is not in the page's control tree.

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

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

The RegisterHiddenField method creates a hidden input element on the rendered HTML page.

.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