Version: 2.0 |

DateTimePickerFormGroup

in namespace DotVVM.Framework.Controls.Bootstrap4

Renders a FormGroup control with a DateTimePicker

Properties

Name Type Description Notes Default Value
ContentTemplate List<DotvvmControl> Gets or sets the content of the form group.
attribute
inner element
static value
bindable
default
Enabled Boolean Gets or sets whether the control is enabled.
attribute
inner element
static value
bindable
default
True
FormatString String Gets or sets format string that will be used to display the date.
attribute
inner element
static value
bindable
default
LabelSize Int32? Gets or sets the size of size the label area for all screen sizes. This applies only to the Horizontal forms.
attribute
inner element
static value
bindable
default
LabelSizeLG Int32? Gets or sets the size of the label area large screen. This applies only to the Horizontal forms.
attribute
inner element
static value
bindable
default
LabelSizeMD Int32? Gets or sets the size of the label area for medium screen. This applies only to the Horizontal forms.
attribute
inner element
static value
bindable
default
LabelSizeSM Int32? Gets or sets the size of the label area small screen. This applies only to the Horizontal forms.
attribute
inner element
static value
bindable
default
LabelSizeXL Int32? Gets or sets the size of the label area for extra large screen. This applies only to the Horizontal forms.
attribute
inner element
static value
bindable
default
LabelTemplate ITemplate Gets or sets the template of the label area. This property cannot be combined with the LabelText property.
attribute
inner element
static value
bindable
default
LabelText String Gets or sets the label text. This property cannot be combined with the LabelTemplate property.
attribute
inner element
static value
bindable
default
Mode DateTimePickerType? Gets or sets whether you want the user to pick only date, only time, or both date and time.
attribute
inner element
static value
bindable
default
DateTime
SelectedDate DateTime? Gets or sets the date selected in the control.
attribute
inner element
static value
bindable
default
Size Size Gets or sets the size of controls in the form group.
attribute
inner element
static value
bindable
default
Default
Type FormGroupType Gets or sets the type of the form.
attribute
inner element
static value
bindable
default
Default

Events

Name Type Description
Changed Command Gets or sets the command that will be triggered when the control text is changed.

Usage & Scenarios

Represents a DateTimePicker in FormGroup.

HTML Rendered by the Control

Sample 1: Basic Usage

The DateTimePickerFormGroup control has the SelectedDate property for storing the datetime the user has selected. It needs to be binded 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: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" />
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: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}" />
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;
    }
}

Suggestions


Help & Contribute

The documentation is maintained on GitHub.
We'll be happy if you edit the page and create a pull request.

Send message