DateTimePickerFormGroup
in namespace DotVVM.Framework.Controls.Bootstrap4
Renders a FormGroup control with a DateTimePicker
Usage & Scenarios
Represents a DateTimePicker in FormGroup.
Sample 1: Basic Usage
The DateTimePickerFormGroup
control has the SelectedDate
property for storing the datetime the user has selected.
It needs to be bound to a property in the viewmodel.
The LabelText
property is used to set the label of the DateTimePickerFormGroup
control.
It is possible with the Mode
property to change what you want the user to pick.
Possible values are Date
for only date, Time
for only time and DateTime
for both date and time.
<bs:Form>
<bs:DateTimePickerFormGroup SelectedDate="{value: Date}" LabelText="Pick a date" Mode="Date" />
<bs:DateTimePickerFormGroup SelectedDate="{value: Date}" LabelText="Pick a datetime" Mode="DateTime" />
<bs:DateTimePickerFormGroup SelectedDate="{value: Date}" LabelText="Pick a time" Mode="Time" />
</bs:Form>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DotVVM.Framework.ViewModel;
namespace DotvvmWeb.Views.Docs.Controls.bootstrap4.DateTimePickerFormGroup.sample1
{
public class ViewModel : DotvvmViewModelBase
{
public DateTime? Date { get; set; } = new DateTime(1993, 10, 7, 10, 30, 0);
}
}
Sample 2: Other properties
It is also possible to change format of displayed datetime with the FormatString
property.
To show / hide the DateTimePickerFormGroup
control use the Visible
property.
<bs:Form>
<bs:DateTimePickerFormGroup SelectedDate="{value: Date}" FormatString="d" LabelText="Pick a date" />
<bs:DateTimePickerFormGroup SelectedDate="{value: Date}" FormatString="g" LabelText="Pick a date" />
<bs:DateTimePickerFormGroup SelectedDate="{value: Date}" FormatString="H:mm:ss" LabelText="Pick a date" />
<bs:DateTimePickerFormGroup SelectedDate="{value: Date}" LabelText="Pick a date" Visible="{value: True}" />
<bs:DateTimePickerFormGroup SelectedDate="{value: Date}" LabelText="Pick a date" Visible="{value: False}" />
</bs:Form>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DotVVM.Framework.ViewModel;
namespace DotvvmWeb.Views.Docs.Controls.bootstrap4.DateTimePickerFormGroup.sample2
{
public class ViewModel : DotvvmViewModelBase
{
public DateTime? Date { get; set; } = new DateTime(1993, 10, 7, 10, 30, 0);
public bool True { get; set; } = true;
public bool False { get; set; } = false;
}
}
Properties
Name | Type | Description | Notes | Default Value | |
---|---|---|---|---|---|
Attributes | Dictionary<String,Object> |
attribute
static value
|
null | ||
ClientIDMode | ClientIDMode | Gets or sets the client ID generation algorithm. |
attribute
static value
|
Static | |
ContentTemplate | List<DotvvmControl> | Gets or sets the content of the form group. |
inner element
static value
bindable
default
|
null | |
DataContext | Object | Gets or sets a data context for the control and its children. All value and command bindings are evaluated in context of this value. |
attribute
bindable
|
null | |
Enabled | Boolean | Gets or sets whether the control is enabled. |
attribute
static value
bindable
|
True | |
FormatString | String | Gets or sets format string that will be used to display the date. |
attribute
static value
|
null | |
ID | String | Gets or sets the unique control ID. |
attribute
static value
bindable
|
null | |
IncludeInPage | Boolean | Gets or sets whether the control is included in the DOM of the page. |
attribute
bindable
|
True | |
InnerText | String | Gets or sets the inner text of the HTML element. |
attribute
static value
bindable
|
null | |
LabelSize | Int32? | Gets or sets the size of size the label area for all screen sizes. This applies only to the Horizontal forms. |
attribute
static value
|
null | |
LabelSizeLG | Int32? | Gets or sets the size of the label area large screen. This applies only to the Horizontal forms. |
attribute
static value
|
null | |
LabelSizeMD | Int32? | Gets or sets the size of the label area for medium screen. This applies only to the Horizontal forms. |
attribute
static value
|
null | |
LabelSizeSM | Int32? | Gets or sets the size of the label area small screen. This applies only to the Horizontal forms. |
attribute
static value
|
null | |
LabelSizeXL | Int32? | Gets or sets the size of the label area for extra large screen. This applies only to the Horizontal forms. |
attribute
static value
|
null | |
LabelTemplate | ITemplate | Gets or sets the template of the label area. This property cannot be combined with the LabelText property. |
inner element
static value
|
null | |
LabelText | String | Gets or sets the label text. This property cannot be combined with the LabelTemplate property. |
attribute
static value
bindable
|
null | |
Mode | DateTimePickerType? | Gets or sets whether you want the user to pick only date, only time, or both date and time. |
attribute
static value
|
DateTime | |
SelectedDate | DateTime? | Gets or sets the date selected in the control. |
attribute
bindable
|
null | |
Size | Size | Gets or sets the size of controls in the form group. |
attribute
static value
bindable
|
Default | |
Type | FormGroupType | Gets or sets the type of the form. |
attribute
static value
|
Default | |
Visible | Boolean | Gets or sets whether the control is visible. |
attribute
bindable
|
True |
Events
Name | Type | Description | |
---|---|---|---|
Changed | Command | Gets or sets the command that will be triggered when the control text is changed. |