aspx:FieldDateTime
This is an HTML input element that can represent a Date, Date/Time or a Time value.
<aspx:FieldDateTime runat='server' value='{!Model.StartDate}'/>
Properties
| Property | Description |
|---|
| Id | The ID of the HTML element. |
| Value | Bind value containing the name of the object and the field to bind. |
| Label | Label the field within the section. If not provided, the actual label of the Entity field will be used. |
| Required | A Boolean value that specifies whether this inputField is a required field. If set to true, the user must specify a value for this field. If not selected, this value defaults to false. |
| Hint | A text value that is shown to the user on the right side of the input component to assist the user. |
| HideLabel | A Boolean value that specifies whether this field's label should be visible or not. If set to false, the input component spans across the entire row. |
| ReadOnly | A Boolean value that specifies whether this field is read only or editable. |
| DateKind | Possible values are: DateTime, Date, Time, YearAndMonth. |
| DateFormat | Using placeholder characters, you can define the desired date format on the field. The default value is yyyy-mm-dd.
(Applies when ReadOnly is set to true) |
| TimeFormat | Using placeholder characters, you can define the desired time format on the field. The default value is hh:mm tt.
(Applies when ReadOnly is set to true) |
Access the user inputs and changes in JavaScript:
//note that the jQuery selector is the same of the binding value: {!Model.StartDate}
$("#StartDate").datetimepicker({ onChange: function(date) {
//do something about the date change.
});
In order to read the value of the date/time picker in JavaScript:
//for datetime pickers:
var d = $("#StartDate").datetimepicker("getDate");
//for date pickers:
var d = $("#StartDate").datepicker("getDate");