User Interface / Widgets / Drop Down Edits / Date Time Box
In This Topic
    Date Time Box
    In This Topic

    The date time box lets the user select a date and/or time from a drop down calendar or some other widget.

     Properties and Events

    The date time box provides the following properties:

    • SelectedDate - indicates the currently selected date. When this property changes, the SelectedDateChanged event is fired.
    • Mode - controls whether the date time box edits date, time or both. Can be one of the following:
      Mode Description
      Date Shows a calendar for picking a date.
      Time Shows 3 numeric up/downs for picking hours, minutes and seconds.
      DateAndTime Shows a calendar and 3 numeric up/downs for picking time.
      MonthAndYear Shows a combo box for selecting a month and a numeric up/down for selecting a year.
    • Format - defines the format of the string representation of the date/time in the text box of the date time box. All .NET framework custom date time strings are supported.
    • CultureName - determines the culture the date time box is localized in.
    • HasTodayButton - determines whether the date time box will have a “Today” button when in Date or DateAndTime mode. When clicked, this button will navigate to the current date.
    • HighlightToday - controls whether the current date (i.e. today) is highlighted or not.
     Code Example

    The following example demonstrates how to create a date time box and handle it SelectedDateChanged event.

    Date Time Box Example
    Copy Code
    dateTimeBox = new NDateTimeBox();
    dateTimeBox.SelectedDateChanged += new Function<NValueChangeEventArgs>(OnDateDropDownSelectedColorChanged);
    
    private void OnDateTimeBoxSelectedColorChanged(NValueChangeEventArgs args)
    {
        DateTime newDate = (DateTime)args.NewValue;
    }