ScriptManager.RegisterHiddenField Method (Page, String, String)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Registers a hidden field with the ScriptManager control during every asynchronous postback.

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

public static void RegisterHiddenField(
	Page page,
	string hiddenFieldName,
	string hiddenFieldInitialValue


Type: System.Web.UI.Page

The page object 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.

Exception Condition

page is null.

- or -

hiddenFieldName is null.

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 every time that an asynchronous postback occurs. To register a hidden field for a control that is inside an UpdatePanel control so that the field is registered only when the panel is updated, use the RegisterHiddenField(Control, 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.

.NET Framework
Available since 3.5
Return to top