Skip to main content

DateTimePicker

Namespace: Wisej.Web.Ext.Syncfusion2

Assembly: Wisej.Web.Ext.Syncfusion2 (4.1.0.0)

The DateTimePicker is a graphical user interface component that allows the user to select, or to enter a datetime value.

public class DateTimePicker : ej2Base

Constructors​

Instance member DateTimePicker()​

Constructs a new instance of the DateTimePicker class.

Example:

The following example creates a date and time picker and configures it through the Options object.

var dateTimePicker = new DateTimePicker();
dateTimePicker.Options.placeholder = "Select date and time";
dateTimePicker.Options.step = 15;
this.Controls.Add(dateTimePicker);

Instance member DateTimePicker(options)​

Constructs a new instance of the DateTimePicker class.

NameTypeDescription
optionsObjectInitial set of options.

Example:

The following example creates a date and time picker that uses the 24-hour format and lists the time in steps of 30 minutes.

var dateTimePicker = new DateTimePicker(new
{
placeholder = "Appointment",
format = "yyyy-MM-dd HH:mm",
timeFormat = "HH:mm",
step = 30
});
this.Controls.Add(dateTimePicker);

Properties​

Instance member Text​

String: Returns or sets the value of the DateTimePicker as a string. (Default: "")

The property reads and writes the value option of the widget. The text assigned to the property is passed to the widget as the new value and should match the format option. Setting the property always fires the TextChanged event.

The property can be used only when the value option is not set or is a string: a value assigned as a DateTime must be read and changed through Options.

The property is not updated when the user selects a value in the browser. To receive the value selected by the user, handle the change event of the widget.

Example:

var dateTimePicker = new DateTimePicker(new { format = "yyyy-MM-dd HH:mm" });
this.Controls.Add(dateTimePicker);

// set the date and time using the format of the picker.
dateTimePicker.Text = "2024-05-01 09:30";

Implements​