How to: Bind ASPxComboBox to DateTime data
The type of the ASPxComboBox value is determined by the ASPxComboBox.ValueType property. This property cannot have the System.DateTime value: this value type is not supported by the control. In general, we recommend using the ASPxDateEdit component for displaying dates. However, there are cases when it is not suitable. For example, it is required that you let an end-user chose one of several predefined dates as the combo box value. In such cases, the following approaches can be used.
- Set the ASPxComboBox.ValueType property value to System.Int32 and use the DateTime.Ticks property of DateTime objects as values for the combo box items.
- Set the ASPxComboBox.ValueType property value to System.String and use string representations of dates instead of DateTime objects.
If the combo box is used inside the ASPxGridView (as an editor inside a template or via the GridViewDataComboBoxColumn), use unbound columns and apply one of the above approaches.
See Also