blog

Home / DeveloperSection / Blogs / HiddenField in ASP.NET

HiddenField in ASP.NET

Uttam Misra3768 30-Oct-2010

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;
    }


Updated 18-Sep-2014
More than 18 years of working experience in IT sector. We are here to serve you best.

Leave Comment

Comments

Liked By