Skip to main content
Tab

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.v24.2.dll

Declaration

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

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.24.2: Components toolbox tab in the Microsoft Visual Studio IDE.

HiddenField in Toolbox

Drag the control onto a form and customize the control’s 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";
}
Imports DevExpress.Web
...
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    Dim hf As ASPxHiddenField = New ASPxHiddenField()
    hf.ID = "ASPxHiddenField1"
    Page.Form.Controls.Add(hf)
    hf.ClientInstanceName = "hiddenField"
End Sub

Note

DevExpress controls require that you register special modules, handlers, and options in the Web.config file. You can change this file or switch to the Design tab in the Microsoft Visual Studio IDE to automatically update the Web.config file. Note that this information is automatically registered if you use the DevExpress Template Gallery to create a project.

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.

Client object type

ASPxClientHiddenField

Access name

ASPxHiddenField.ClientInstanceName

Events

ASPxHiddenField.ClientSideEvents

Note

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

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

See Also