DOT

VVM

 DOCS

Version: 1.0 | 1.1 |

InputGroup

in namespace DotVVM.Framework.Controls.Bootstrap

Renders a Bootstrap input group widget.

Properties

Name Type Description Notes Default Value
ClientIDMode ClientIDMode Gets or sets the client ID generation algorithm.
attribute
inner element
static value
bindable
default
1
ContentTemplate ITemplate Gets or sets the main content of the input group.
attribute
inner element
static value
bindable
default
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
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
LeftTemplate ITemplate Gets or sets the left side extension of the input group.
attribute
inner element
static value
bindable
default
RightTemplate ITemplate Gets or sets the right side extension of the input group.
attribute
inner element
static value
bindable
default
Size InputGroupSize Gets or sets the size of the button.
attribute
inner element
static value
bindable
default
0
Visible Boolean Gets or sets whether the control is visible.
attribute
inner element
static value
bindable
default
True

Events

Name Type Description

Usage & Scenarios

Renders a Bootstrap input group which decorates the TextBox with buttons or other controls on the side.

http://getbootstrap.com/components/#input-groups

HTML Rendered by the Control

Sample 1: Basic Usage

  • The InputGroup control has the ContentTemplate property which must contain a TextBox control.

It also has the LeftTemplate and RightTemplate properties that define the content on the left and right of the textbox.

The following types of content are supported in these templates:

There is also the Size property which can be set to Large, Small and Default.

<bs:InputGroup>
  <LeftTemplate>
    <bs:Button Text="Button" Click="{command: UpdateText()}" />
  </LeftTemplate>
  <ContentTemplate>
    <dot:TextBox Text="{value: Text}" />
  </ContentTemplate>
  <RightTemplate>
    <span>Click the Button on the left.</span>
  </RightTemplate>
</bs:InputGroup>

<bs:InputGroup Size="Small">
  <LeftTemplate>
    <!-- to make the CheckBox look nice, use IsInline="true" -->
    <bs:CheckBox Checked="{value: Checked}" Changed="{command: UpdateText2()}" IsInline="true" />
  </LeftTemplate>
  <ContentTemplate>
    <dot:TextBox Text="{value: Text2}" />
  </ContentTemplate>
  <RightTemplate>
    <span>Click the CheckBox on the left.</span>
  </RightTemplate>
</bs:InputGroup>
using DotVVM.Framework.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace DotvvmWeb.Views.Docs.Controls.bootstrap.InputGroup.sample1
{
    public class ViewModel : DotvvmViewModelBase
    {
        public string Text { get; set; }
        public int Clicks { get; set; } = 0;
        

        public void UpdateText()
        {
            Clicks++;
            Text = "Button was clicked " + Clicks + 'x';
        }

        public string Text2 { get; set; }
        public bool Checked { get; set; }

        public void UpdateText2()
        {
            Text2 = "Checkbox was " + (Checked ? "checked" : "unchecked");
        }
    }
}

Sample 2: Multiple Controls in the InputGroup

You can also place multiple controls in the LeftTemplate and RightTemplate properties, e.g. RadioButtons or a combination of Buttons and DropDownButtons.

<bs:InputGroup>
  <LeftTemplate>
    <dot:RadioButton CheckedItem="{value: Color}" CheckedValue="r" Text="R" />
    <dot:RadioButton CheckedItem="{value: Color}" CheckedValue="g" Text="G" />
    <dot:RadioButton CheckedItem="{value: Color}" CheckedValue="b" Text="B" />
  </LeftTemplate>
  <ContentTemplate>
    <dot:TextBox Text="{value: Color}"/>
  </ContentTemplate>
  <RightTemplate>
    <bs:Button Text="Button 1" />
    <bs:Button Text="Button 2" />
  </RightTemplate>
</bs:InputGroup>
using DotVVM.Framework.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace DotvvmWeb.Views.Docs.Controls.bootstrap.InputGroup.sample2
{
    public class ViewModel : DotvvmViewModelBase
    {
        public string Color { get; set; } = "g";
    }
}

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