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
property icon ContentTemplate List<DotvvmControl> Gets or sets the content of the form group.
attribute
inner element
static value
bindable
default
null
property icon ControlID String Gets or sets the ID of the main control inside the FormGroup to be associated with the label.
attribute
inner element
static value
bindable
default
null
property icon Enabled Boolean Gets or sets whether the control is enabled.
attribute
inner element
static value
bindable
default
True
property icon FormatString String Gets or sets format string that will be used to display the date.
attribute
inner element
static value
bindable
default
null
property icon 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
null
property icon 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
null
property icon 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
null
property icon 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
null
property icon 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
null
property icon 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
null
property icon LabelText String Gets or sets the label text. This property cannot be combined with the LabelTemplate property.
attribute
inner element
static value
bindable
default
null
property icon 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
property icon SelectedDate DateTime? Gets or sets the date selected in the control.
attribute
inner element
static value
bindable
default
null
property icon Size Size Gets or sets the size of controls in the form group.
attribute
inner element
static value
bindable
default
Default
property icon Type FormGroupType Gets or sets the type of the form.
attribute
inner element
static value
bindable
default
Default
property icon UsedControlIDList HashSet<String>
attribute
inner element
static value
bindable
default
null

Events

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

HTML produced by the control