共用方式為


HiddenField Web Server Control Declarative Syntax 

Creates a hidden field that is used to store a non-displayed value.

<asp:HiddenField
    EnableTheming="True|False"
    EnableViewState="True|False"
    ID="string"
    OnDataBinding="DataBinding event handler"
    OnDisposed="Disposed event handler"
    OnInit="Init event handler"
    OnLoad="Load event handler"
    OnPreRender="PreRender event handler"
    OnUnload="Unload event handler"
    OnValueChanged="ValueChanged event handler"
    runat="server"
    SkinID="string"
    Value="string"
    Visible="True|False"
/>

Remarks

The HiddenField control is used to store a value that needs to be persisted across posts to the server. It is rendered as an <input type= "hidden"/> element.

For more information on the HiddenField control, see HiddenField Web Server Control.

Example

The following code example demonstrates how to use the HiddenField control to store a hidden value on a rendered Web page.

<asp:HiddenField id="HiddenField1" runat="server" value="1"/>
<asp:HiddenField id="HiddenField1" runat="server" value="1"/>

See Also

Reference

HiddenField

Other Resources

HiddenField Web Server Control