DOT

VVM

 DOCS

Version: 1.0 | 1.1 |

DateTimePickerGroup

in namespace DotVVM.Framework.Controls.Bootstrap

Properties

Name Type Description Notes Default Value
Attributes Dictionary<String,Object>
attribute
inner element
static value
bindable
default
ClientIDMode ClientIDMode Gets or sets the client ID generation algorithm.
attribute
inner element
static value
bindable
default
Static
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
FormatString String Gets or sets a format of presentation of value to client.
attribute
inner element
static value
bindable
default
FormContent List<DotvvmControl> Gets or sets the content of the form group.
attribute
inner element
static value
bindable
default
ID String Gets or sets the unique control ID.
attribute
inner element
static value
bindable
default
InnerText String Gets or sets the inner text of the HTML element.
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
RenderContentContainers Boolean Gets or sets whether an additional container will be rendered around the content.
attribute
inner element
static value
bindable
default
True
SelectedDate DateTime? Gets or sets the date selected in the control.
attribute
inner element
static value
bindable
default
Visible Boolean Gets or sets whether the control is visible.
attribute
inner element
static value
bindable
default
True

Events

Name Type Description

Usage & Scenarios

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

HTML Rendered by the 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;
    }
}

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