Back to Devexpress

DateEdit

aspnetmvc-8985-components-data-editors-extensions-dateedit.md

latest2.5 KB
Original Source

DateEdit

  • Jul 09, 2021
  • 4 minutes to read

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

To learn more about DateEdit and see it in action, refer to our online demos.

Implementation Details

DateEdit is realized by the DateEditExtension class. Its instance can be accessed via the ExtensionsFactory.DateEdit helper method, which is used to add a DateEdit extension to a view. This method’s parameter provides access to the DateEdit ‘s settings implemented by the DateEditSettings class, allowing you to fully customize the extension.

DateEdit ‘s client counterpart is represented by the MVCxClientDateEdit object.

Declaration

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

razor
@Html.DevExpress().DateEdit(settings => {
    settings.Name = "dateEdit1";
    settings.Properties.DisplayFormatString = "D";
    settings.Date = new DateTime(1984, 06, 14);
}).GetHtml()

Note

The Partial View should contain only the extension’s code.

The code result is demonstrated in the image below.

Main Features

The DateEdit extension is a date editor that combines the functionalities of a single-line text editor, button editor and dropdown calendar. The editor’s dropdown displays a calendar that allows end-users to select dates, and navigate through months and years.

The DateEdit offers the following features.

  • Shared Drop-Down Calendar

  • Null Prompt Text

  • Edit Formatting

  • Display Formatting

  • Masked Input

  • Month-Year Picker Mode

  • Easy Date Selection

  • Customizable Button Collection

  • Built-in Validation

  • Full-Featured Client-Side API