DateTimePickerGroup

in namespace DotVVM.Framework.Controls.Bootstrap

Usage & Scenarios

Represents a group of Label and DateTimePicker in the Form control.

Sample 1: Basic Usage

The DateTimePickerGroup 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 DateTimePickerGroup 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:DateTimePickerGroup SelectedDate="{value: Date}" LabelText="Pick a date" Mode="Date" />

<bs:DateTimePickerGroup SelectedDate="{value: Date}" LabelText="Pick a datetime" Mode="DateTime" />

<bs:DateTimePickerGroup 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.bootstrap.DateTimePickerGroup.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 DateTimePickerGroup control use the Visible property.

<bs:DateTimePickerGroup SelectedDate="{value: Date}" FormatString="d" LabelText="Pick a date" />

<bs:DateTimePickerGroup SelectedDate="{value: Date}" FormatString="g" LabelText="Pick a date" />

<bs:DateTimePickerGroup SelectedDate="{value: Date}" FormatString="H:mm:ss" LabelText="Pick a date" />

<bs:DateTimePickerGroup SelectedDate="{value: Date}" LabelText="Pick a date" Visible="{value: True}" />

<bs:DateTimePickerGroup 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.bootstrap.DateTimePickerGroup.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 ClientIDMode ClientIDMode Gets or sets the client ID generation algorithm.
attribute
inner element
static value
bindable
default
1
property icon 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
inner element
static value
bindable
default
null
property icon FormatString String Gets or sets a format of presentation of value to client.
attribute
inner element
static value
bindable
default
null
property icon FormContent List<DotvvmControl> Gets or sets the content of the form group.
attribute
inner element
static value
bindable
default
null
property icon ID String Gets or sets the unique control ID.
attribute
inner element
static value
bindable
default
null
property icon InnerText String Gets or sets the inner text of the HTML element.
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
2
property icon RenderContentContainers Boolean Gets or sets whether an additional container will be rendered around the content.
attribute
inner element
static value
bindable
default
True
property icon SelectedDate DateTime? Gets or sets the date selected in the control.
attribute
inner element
static value
bindable
default
null
property icon Visible Boolean Gets or sets whether the control is visible.
attribute
inner element
static value
bindable
default
True

HTML produced by the control