Uredi

Deli z drugimi prek


ScriptManager.RegisterHiddenField Method

Definition

Registers a hidden field.

Overloads

RegisterHiddenField(Control, String, String)

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

RegisterHiddenField(Page, String, String)

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

RegisterHiddenField(Control, String, String)

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

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

Parameters

control
Control

The control that is registering the hidden field.

hiddenFieldName
String

The name of the hidden field to register.

hiddenFieldInitialValue
String

The initial value of the hidden field.

Exceptions

control is null.

-or-

hiddenFieldName is null.

control is not in the page's control tree.

Remarks

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.

See also

Applies to

RegisterHiddenField(Page, String, String)

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

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

Parameters

page
Page

The page object that is registering the hidden field.

hiddenFieldName
String

The name of the hidden field to register.

hiddenFieldInitialValue
String

The initial value of the hidden field.

Exceptions

page is null.

-or-

hiddenFieldName is null.

Remarks

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.

See also

Applies to