aspnet-8985-aspnet-mvc-extensions-data-editors-extensions-dateedit.md
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.
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.
DateEdit can be added to a view in the following manner.
View code (ASPX):
<%
Html.DevExpress().DateEdit(
settings => {
settings.Name = "dateEdit1";
settings.Properties.DisplayFormatString = "D";
settings.Date = new DateTime(1984, 06, 14);
}
)
.Render();
%>
View code (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