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

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).

For example, on the server side, a date-time value can be inserted into the control's value collection in the following manner:

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

Then, on the client side, this value can be accessed and modified as a date object:

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

And, after that, on the server side, you can again manipulate this value as a date object:

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