- HTML Hidden Web Server Control
In ASP.NET environment,This article describes you how to work with HTML Hidden Control.In HTML environment, Hidden is an object that represents a Hidden control in an HTML form. The Hidden control in a HTML form contains all instance of an <input type="hidden"> tag.
The HtmlInputHidden control can be used to comprised information that is concealed from the user that means user unable to view the information. This information is sent when the Web page is posted back to the server.
There are several functions available to access the HTML Hidden.some of its funtions are as follows,
- document.getElementById()
- document.getElementByName()
Hidden Objects Properties
- id -Sets or returns the id of a Hidden
- form -Returns a reference to the form that contains the Hidden
- alt -Sets or returns an alternate text to display if a browser does not support Hiddens
- name -Sets or returns the name of a Hidden
- type -Returns the type of form element a Hidden is
- value -Sets or returns the text that is displayed on the Hidden
- title -Sets or returns an element's advisory title
- lang -Sets or returns the language code for an element
- dir -Sets or returns the direction of text
- className -Sets or returns the class attribute of an element
Hidden Objects Methods
- blur() -Performs focus when leave from the control
- click() -Simulates a mouse-click on a Hidden
- focus() -Performs focus when enter into the control
The following code snippets explains you the HTML Hidden in the web form.
in .aspx.cs page,
-
void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
Span1.InnerHtml="Hidden value: " + hid1.Value + "";
}
}
void SubmitBtn_Click(object sender, EventArgs e)
{
hid1.Value=StringContents.Value;
}
-
in .aspx page,
-
<form id="Form2" runat=server>
<h3>HtmlInputHidden Sample</h3>
<input id="hid1"
type=hidden
value="Initial Value"
runat=server>
<input id="StringContents"
type=text
size=40
runat=server>
<p>
<input id="Submit1" type=submit
value="Enter"
OnServerClick="SubmitBtn_Click"
runat=server>
<p>
</form>
-
- Related Links
-
8fa802e9-e60d-4dda-8aa1-30c3dc574500|0|.0