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

ASPxHiddenField Class

Represents a non visual component to store a set of values and synchronize them between the server and client sides across round trips.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v19.1.dll

Declaration

public class ASPxHiddenField :
    ASPxWebComponent,
    IDictionary<string, object>,
    ICollection<KeyValuePair<string, object>>,
    IEnumerable<KeyValuePair<string, object>>,
    IEnumerable

The following members accept/return ASPxHiddenField objects:

Remarks

The ASPxHiddenField component allows you to transfer values between server and client.

Create a Hidden Field

Design Time

The ASPxHiddenField control is available on the DX.19.1: Components toolbox tab in the Microsoft Visual Studio IDE.

Drag the control onto a form and customize control settings, or paste the control markup in the page’s source code.

<dx:ASPxHiddenField ID="ASPxHiddenField1" ClientInstanceName="hiddenField" runat="server">
</dx:ASPxHiddenField>

Run Time

using DevExpress.Web;
...
protected void Page_Load(object sender, EventArgs e)
{
    ASPxHiddenField hf = new ASPxHiddenField();
    hf.ID = "ASPxHiddenField1";
    Page.Form.Controls.Add(hf);
    hf.ClientInstanceName = "hiddenField";
}

Client-Side API

The ASPxHiddenField‘s client-side API is implemented with JavaScript language and is exposed by the ASPxClientHiddenField object.

Availability

Available by default.

Class name

ASPxClientHiddenField

Access name

ClientInstanceName

Events

ASPxHiddenField.ClientSideEvents

NOTE

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

Features

Dictionary Storage

The ASPxHiddenField is a dictionary that maintain an unlimited number of elements (key/value pairs). In a key/value pair, a key is a property name (a string) and a value - a property value (an object). Property names (keys) must be unique. Property names can contain any symbols except for the symbols | and # (the vertical bar and the hash sign).

See demo

Supported Value Types

You can store property values of different types in the hidden field.

The hidden field automatically preserves value types and does not require converting values to the required type. It allows you to manipulate the same value type both on the server and client sides.

Learn more

Synchronization

Use the ASPxHiddenField.SyncWithServer property to specify whether the control synchronizes its values between the client and server sides. Synchronization is in effect when either the control sends a postback or callback. Set the ASPxHiddenField.SyncWithServer property to false when you use the hidden field only to pass values from the server to the client. This minimizes data transfer between the client and the server.

NOTE

ASPxHiddenField stores all its content in its own hidden input and does not use ViewState. As a result, the ASPxHiddenField’s properties are not automatically available across roundtrips to the client.

Online Demo

ASPxHiddenField - Example