Skip to main content

TimeEditFor

TimeEditFor is an editor capable of displaying and editing time values. It consists of an edit region and a pair of spin buttons, which can be used to adjust the date-time value.

Implementation Details

TimeEditFor is realized by the TimeEditExtension class. Its instance can be accessed via the ExtensionsFactory<ModelType>.TimeEditFor<ValueType> helper method, which is used to add a TimeEditFor extension to a view. This first method’s parameter is an expression that identifies model property to display and edit. The second method’s parameter provides access to the TimeEditFor‘s settings implemented by the TimeEditSettings class, allowing you to fully customize the extension.

The TimeEditFor‘s client counterpart is represented by the ASPxClientTimeEdit object.

Declaration

TimeEditFor can be added to a view in the following manner.

@Html.DevExpress().TimeEditFor(model => model.ArrivalTime,
    settings => {
        settings.Properties.DisplayFormatString = "h:mm tt";
        settings.Properties.EditFormat = EditFormat.DateTime;
    }).GetHtml()

The code result is demonstrated in the image below.

timeedit-declaration.png

See Also