A newer version of this page is available. Switch to the current version.

ASPxHiddenField Class

Represents a non visual component that is capable of storing a set of values of different types, and synchronizing them between the server and client sides across round trips.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v18.2.dll


public class ASPxHiddenField :
    IDictionary<string, object>,
    ICollection<KeyValuePair<string, object>>,
    IEnumerable<KeyValuePair<string, object>>,
Public Class ASPxHiddenField
    Inherits ASPxWebComponent
    Implements IDictionary(Of String, Object),
               ICollection(Of KeyValuePair(Of String, Object)),
               IEnumerable(Of KeyValuePair(Of String, Object)),

Related API Members

The following members accept/return ASPxHiddenField objects:


ASPxHiddenField Overview

The ASPxHiddenField component provides you with an easy and convenient way to transfer values between server and client.

The ASPxHiddenField component represents a dictionary that can maintain an unlimited number of elements. Each element is represented by a key/value pair. The key can be considered as a property name (a string) and the value - as a property value (an object). Property names must be unique and immutable as long as they are used as keys in the ASPxHiddenField. Property names can contain any symbols except for the symbols | and # (the vertical bar and the hash sign) which are considered to be service symbols within ASPxHiddenField.

Using the ASPxHiddenField, you can store property values of different (not only string) types. See the Data Types Supported by the ASPxHiddenField for more details on the supported types.

The unique advantage of the ASPxHiddenField component is that it automatically preserves value types, allowing you to manipulate the same value type both on the server and client sides. So, it's not required to convert values to the required types manually. See the Preserving Value Types topic to learn more.

The ASPxHiddenField component provides you with a comprehensive and easy-to-use server and client API to manipulate its values. On the server side, you can define a new value by using the ASPxHiddenField.Add and ASPxHiddenField.Set methods and the ASPxHiddenField.Item property. On the client side, the ASPxClientHiddenField.Add and ASPxHiddenField.Set methods can be used for the same purposes. A value can be removed from the collection via the server ASPxHiddenField.Remove method or the client ASPxClientHiddenField.Remove method. To clear the value collection, use the ASPxHiddenField.Clear method on the server or ASPxClientHiddenField.Clear method on the client.


ASPxHiddenField stores all its required content within its own specific hidden input and does not use ViewState (the control's ASPxHiddenField.EnableViewState property is overriden to always return false and to be hidden). As a result, ASPxHiddenField's properties will not be automatically persisted across roundtrips to the client.

Use the ASPxHiddenField.SyncWithServer property, to control whether synchronization of the control's values is available between the client and server sides. By default, this property is true, and the changes made to the control's values on the client side are automatically synchronized with the server on the nearest round trip. This value synchronization is always in effect: it doesn't depend upon the manner in which a round trip is initiated - be it a postback or callback technology. If you intend to use the ASPxHiddenField component only to pass values from the server to the client, it's recommended that you set the ASPxHiddenField.SyncWithServer property to false, to minimize data transfer between the client and the server.


The ASPxHiddenField control provides you with a comprehensive client-side functionality implemented using JavaScript code (see DevExpress.Web.Scripts to learn more):

The client-side API is always available for this control.

Online Demo

ASPxHiddenField - Example


The following part of the ASPxHiddenField online demo illustrates how to manipulate the ASPxHiddenField items collection on the client and server side by using the ASPxClientHiddenField.Get, ASPxClientHiddenField.Set, ASPxHiddenField.Item property etc.

var viewsCount = 3;
function ShowPrevPage(){
function ShowNextPage(){
function ChangeActiveViewIndex(changeIndex){
    hfAnswers.Set("questionIndex", GetQuestionIndex() + changeIndex);
function GetQuestionIndex(){
    return hfAnswers.Get("questionIndex");
function IsPreviewPage(){
    return GetQuestionIndex() == (viewsCount - 1);
function OnSeasonChanged(s, e){
    hfAnswers.Set("month", 0);
    hfAnswers.Set("season", s.GetSelectedIndex());
function OnMonthChanged(s, e){
    hfAnswers.Set("month", s.GetSelectedIndex());
See Also