HiddenField Control

The ASP.Net HiddenField control enables you to store the information at client side in the web browser that persists even after post back event of web page. Usually we use Session, ViewState or Cookies to maintain the state of the web page. The HiddenField control also provides the similar functionality to store the persistent data and maintains its state across post backs to the server. If session, view state or cookie methods are not available then you can use the HiddenField control to maintain the web page state. The ASP.Net HiddenField control renders as HTML input control with type attribute as "hidden". It does not appear physically in the graphical representation of web page but you can access it in the server code and get or set its value using C# code in the server end script.


Properties of ASP.Net HiddenField Control

The ASP.Net HiddenField control provides following properties that can be used to store the information at client side:

1. Value

2. Visible


The Value property enables you to get or set the information that you want to store in the hidden field control. The visible property allows you to show or hide the HTML markup code of hidden field control in the source code. But if you will set the visible property to "false" then the ViewState will play its role to hold the value of hidden field instead.


HiddenField Control Event

The HiddenField control provides OnValueChanged event that is raised at the time value of hidden field control changes between the post back event of web page. You can get the updated value of control and display it or use it for further processing.


In the sample below we have used the ASP.Net HiddenField control to hold the clicks count of button control that will get incremeneted each time you will click the button control. Try the sample below to understand the working of ASP.Net HiddenField control:

Clicked 0 times
  1. Adrotator Control Using XML File
  2. CheckBox Control Sample
  3. FileUpload File Type Filter using JavaScript
  4. LinkButton Control Click Event
  5. RadioButton Control Sample
  6. RadioButton Control Checked and GroupName Property
  7. LinkButton Control Command Event
  8. HiddenField Control
  9. CheckBox Checked Property
  10. Adrotator Control using SqlDataSource
  11. BulletedList Control
  12. CheckBox AutoPostBack Property
  13. HiddenField Control OnValueChanged Event
  14. LinkButton OnClientClick Property
  15. RadioButton Control AutoPostBack Property
  16. RadioButton Control OnCheckedChanged Event
  17. LinkButton JavaScript Confirm Message Box
  18. HyperLink Control Sample
  19. CheckBox OnCheckedChanged Event
  20. BulletedList Control using DisplayMode
  21. BulletedList Control using SqlDataSource
  22. CheckBox Control JavaScript Validation
  23. HyperLink Control NavigateUrl Property
  24. LinkButton JavaScript Alert Box
  25. RadioButtonList Control Sample
  26. RadioButtonList Control Layout Properties
  27. LinkButton PostBackUrl Property
  28. HyperLink Control Target Property
  29. CheckBox Control Select All Using PostBack in C#
  30. BulletedList Control with Click Event
  31. Button Control
  32. CheckBox Control Check All Using JavaScript
  33. HyperLink Control ImageUrl Property
  34. Multiple LinkButtons Single Command Event Handler
  35. RadioButtonList Control OnSelectedIndexChanged Event
  36. RadioButtonList Control with SQL DataBinding
  37. ListBox Control Sample
  38. HyperLink Control OnClick Event
  39. CheckBoxList Control Sample
  40. Button Click Event
  41. Button Command Event
  42. CheckBoxList Control Layout Properties
  43. HyperLink Control Open in New Window
  44. ListBox Control AutoPostBack Property
  45. Populate RadioButtonList Control Items Dynamically
  46. TextBox Control Text Property
  47. ListBox Control OnSelectedIndexChanged Event
  48. Image Control Sample
  49. CheckBoxList Control OnSelectedIndexChanged Event
  50. Button OnClientClick Property
  51. Button Confirm Message Box
  52. CheckBoxList Control with SQL DataBinding
  53. Image Control ImageAlign Property
  54. ListBox Control SelectionMode Property
  55. TextBox Control TextMode Property
  56. TextBox Control OnTextChanged Event
  57. ListBox Control with SQL DataBinding
  58. ImageButton Control Sample
  59. CheckBoxList Control Selected Items
  60. Button Alert Message Box
  61. Button UseSubmitBehavior Property
  62. Populate CheckBoxList Control Items Dynamically
  63. ImageButton OnClick Event
  64. ListBox Control Get Multiple Selected Items
  65. XML Control with DocumentSource and TransformSource Property
  66. Populate ListBox Items Dynamically
  67. ImageButton OnCommand Event
  68. CheckBoxList Control JavaScript Validation
  69. Button PostBackUrl Property
  70. Multiple Button Controls with Single Event Handler
  71. CheckBoxList Control Select All Using PostBack in C#
  72. ImageButton OnClientClick Property
  73. ListBox Control SelectedValue Property
  74. ListBox Control SelectedIndex Property
  75. ImageButton PostBackUrl Property
  76. CheckBoxList Control Select All Using JavaScript
  77. Calendar Control
  78. Calendar Control SelectionMode Property
  79. DropDownList Control Sample
  80. Determine the Image Coordinates Using ImageButton Control
  81. Literal Control
  82. Literal Control Mode Property
  83. ImageMap Control
  84. DropDownList Control AutoPostBack Property
  85. Calendar Control SelectionChanged Event
  86. Calendar Control VisibleMonthChanged Event
  87. DropDownList Control OnSelectedIndexChanged Event
  88. ImageMap HotSpotMode Property
  89. Panel Control
  90. PlaceHolder Control
  91. ImageMap Click Event
  92. DropDownList Control with SQL DataBinding
  93. Calendar Control DayRender Event
  94. Calendar Control Date with Custom Content
  95. Populate DropDownList Items Dynamically
  96. ImageMap PostBackValue Property
  97. Label Control Text Property
  98. Setting DropDownList Default Value
  99. Calendar Control SelectedDates Dynamically
  100. Calendar Control SelectedDates using SQL Database
  101. DropDownList Control SelectedValue Property
  102. Label Control As Caption
  103. DropDownList Control SelectedIndex Property
  104. Calendar Control in Popup Window
  105. Calendar Control Customized with CSS Styles
  106. DropDownList Control JavaScript Validation
  107. DropDownList DataTextField with Multiple Columns
  108. Calendar DatePicker Control
  109. DropDownList Control with XML DataBinding