Skip to main content

GridViewDataTimeEditColumn Class

A data column that displays DateTime values.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web


public class GridViewDataTimeEditColumn :


GridViewDataTimeEditColumn objects represent data columns used to display and edit time portions of data taken from DateTime data fields. The column editor’s settings can be accessed and customized using the GridViewDataTimeEditColumn.PropertiesTimeEdit property.

To learn more, see Data Columns.

Display a TimeSpan value in a column

To display a TimeSpan values in a column, hide the original column bound to the DateTime field and use an extra Unbound Column to perform the conversion between TimeSpan and DateTime types.

<dx:ASPxGridView ID="ASPxGridView1" runat="server"  
    <dx:GridViewDataTimeEditColumn FieldName="Time" Visible="false" />  
    <dx:GridViewDataTimeEditColumn FieldName="UnboundTime" Caption="Time" UnboundType="DateTime">  
        <PropertiesTimeEdit DisplayFormatString="HH:mm:ss" EditFormat="Custom" EditFormatString="HH:mm:ss" />  
// Display value
protected void ASPxGridView1_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridViewColumnDataEventArgs e) {  
    if (e.Column.FieldName == "UnboundTime") {  
        e.Value = DateTime.MinValue.Add((TimeSpan)e.GetListSourceFieldValue("Time"));  
// Get value
protected void ASPxGridView1_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) {  
    DateTime date = (DateTime)e.NewValues["UnboundTime"];  
    e.NewValues["Time"] = date.TimeOfDay;  
protected void ASPxGridView1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) {  
    DateTime date = (DateTime)e.NewValues["UnboundTime"];  
    e.NewValues["Time"] = date.TimeOfDay;  
See Also