DateEditFor

DateEditFor combines the functionality of a single-line text editor, button editor and dropdown calendar. The editor's dropdown displays a single-month calendar that allows end-users to select dates, and navigate through months and years. Specifying a date (by selecting it on the calendar or by manually typing it into the text box) changes the editor's edit value.

Implementation Details

DateEditFor is realized by the DateEditExtension class. Its instance can be accessed via the ExtensionsFactory<ModelType>.DateEditFor<ValueType> helper method, which is used to add a DateEditFor 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 DateEditFor's settings implemented by the DateEditSettings class, allowing you to fully customize the extension.

DateEditFor's client counterpart is represented by the ASPxClientDateEdit object.

Declaration

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

View code (Razor):

@Html.DevExpress().DateEditFor(model => model.BirthDate,
    settings => {
        settings.Properties.DisplayFormatString = "D";
    }).GetHtml()

The code result is demonstrated in the image below.

dateedit-declaration.png

See Also