Tab
A newer version of this page is available. Switch to the current version.

ASPxDateEdit Class

A date editor control.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v19.1.dll

Declaration

public class ASPxDateEdit :
    ASPxDropDownEditBase,
    ITimeSectionOwner,
    ICalendarSharedPropertiesOwner,
    IAllowNullOwner

The following members accept/return ASPxDateEdit objects:

Remarks

The ASPxDateEdit is a drop-down editor that provides the drop-down calendar and time editor.

The calendar allows end users to select dates and navigate through months and years. The ASPxDateEdit.Date property specifies the currently selected date. Change this property to raise the ASPxDateEdit.DateChanged event.

The editor’s dropdown window contains two sections:

Create a Date Edit

Design Time

The ASPxDateEdit control is available on the DX.19.1: Common Controls toolbox tab in the Microsoft Visual Studio IDE.

Drag the control onto a form and customize control settings, or paste the control markup in the page’s source code.

<dx:ASPxDateEdit ID="dateEdit" runat="server" EditFormat="Custom" Date="2009-11-02 09:23" 
Width="190" Caption="ASPxDateEdit">
    <TimeSectionProperties>
        <TimeEditProperties EditFormatString="hh:mm tt" />
    </TimeSectionProperties>
    <CalendarProperties>
        <FastNavProperties DisplayMode="Inline" />
    </CalendarProperties>
</dx:ASPxDateEdit>

Run Time

using DevExpress.Web;
...
protected void Page_Load(object sender, EventArgs e)
{
    ASPxDateEdit dateEdit = new ASPxDateEdit();
    dateEdit.ID = "ASPxDateEdit1";
    Page.Form.Controls.Add(dateEdit);

    dateEdit.EditFormat = EditFormat.Custom;
    dateEdit.Date = DateTime.Today;
    dateEdit.Caption = "Test date edit";
    dateEdit.CalendarProperties.FastNavProperties.DisplayMode = FastNavigationDisplayMode.Inline;
    dateEdit.TimeSectionProperties.Visible = true;
    dateEdit.TimeSectionProperties.TimeEditProperties.EditFormatString = "hh:mm tt";
    dateEdit.DisplayFormatString = "dd/MM/yyyy hh:mm tt";
}

Features

Shared Drop-Down Calendar

Use the PopupCalendarOwnerID property to share a date editor’s popup calendar between several date editors. This allows you to decrease the rendered HTML size.

<dx:ASPxDateEdit ID="dtmDate1" runat="server" Date="2018-12-30" ...>
</dx:ASPxDateEdit>

<dx:ASPxDateEdit ID="dtmDate2" runat="server" PopupCalendarOwnerID="dtmDate1">
</dx:ASPxDateEdit> 

<dx:ASPxDateEdit ID="dtmDate3" runat="server" PopupCalendarOwnerID="dtmDate1">
</dx:ASPxDateEdit>

Null Prompt Text

The date editor displays a prompt text (NullText) when the editor’s value is null and the editor is not focused. The prompt text disappears when the editor receives focus.