HiddenField

The HiddenField control provides you with a way to store information in the page without displaying it. This control enables a developer to store a non-displayed value. You can use the Hidden Field control to store state values. Note that because the value of a Hidden Field is rendered to the client browser, it is not suitable for storing security-sensitive values.

 <asp:HiddenField ID="HiddenField1" runat="server" />

 <asp:HiddenField ID="HiddenField1" runat="server" />

 <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

 <asp:Label ID="Label1" runat="server"></asp:Label>

 <asp:Button ID="Button1" runat="server" OnClick="Button1_Click"     Text="Button" />

 

protected void Page_Load(object sender, EventArgs e)

    {

        HiddenField1.Value = TextBox1.Text;

      

    }

   

    protected void Button1_Click(object sender, EventArgs e)

    {

        Label1.Text = HiddenField1.Value;

    }

Leave Comment