DatePicker
Namespace: Wisej.Web.Ext.Syncfusion2
Assembly: Wisej.Web.Ext.Syncfusion2 (4.1.0.0)
Represents the DatePicker component that allows user to select or enter a date value.
- C#
- VB.NET
public class DatePicker : ej2Base
Public Class DatePicker
Inherits ej2Base
Constructors
DatePicker()
Constructs a new instance of the DatePicker class.
Example:
The following example creates a date picker and configures it through the Options object.
var datePicker = new DatePicker();
datePicker.Options.placeholder = "Select a date";
datePicker.Options.format = "dd/MM/yyyy";
this.Controls.Add(datePicker);
DatePicker(options)
Constructs a new instance of the DatePicker class.
| Name | Type | Description |
|---|---|---|
| options | Object | Initial set of options. |
Example:
The following example creates a date picker that allows the user to select a date within the next 30 days.
var datePicker = new DatePicker(new
{
value = DateTime.Today,
min = DateTime.Today,
max = DateTime.Today.AddDays(30),
format = "yyyy-MM-dd"
});
this.Controls.Add(datePicker);
Properties
Text
String: Returns or sets the value of the DatePicker 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 value option must be assigned, in the constructor or through Options, before setting this property, and the assigned text cannot be null.
The property is not updated when the user selects a date in the browser. To receive the date selected by the user, handle the change event of the widget.
Example:
var datePicker = new DatePicker(new
{
format = "yyyy-MM-dd",
value = new DateTime(2024, 5, 1)
});
this.Controls.Add(datePicker);
// change the date using the format of the picker.
datePicker.Text = "2024-12-25";