Skip to main content

Preserving Value Types

The types of values maintained by the ASPxHiddenField component are automatically preserved, regardless of whether you write server code (using C# or VB) or client code (using JavaScript).

The following code demonstrates how to insert a DateTime value on the server side into the control’s value collection:

ASPxHiddenField1["myBirthDay"] = new DateTime(1985, 8, 29);

On the client side, you can access and modify this value as a Date object:

var date = ASPxHiddenField1.Get("myBirthDay");
date.setHours(15, 23); // You can manipulate the obtained value as a date value.
ASPxHiddenField1.Set("myBirthDay", date);

On the server side, you can again manipulate this value as a DateTime object:

DateTime date = (DateTime)ASPxHiddenField1["myBirthDay"];
int hour = date.Hour; // This value is 15.
See Also