Version: 2.0 |

InputGroup

in namespace DotVVM.Framework.Controls.Bootstrap4

Renders a Bootstrap input group widget.

Properties

Name Type Description Notes Default Value
ContentTemplate List<IInputGroupContentItem> Gets or sets the main content of the input group.
attribute
inner element
static value
bindable
default
LeftTemplate List<IInputGroupSideItem> Gets or sets the left side extension of the input group.
attribute
inner element
static value
bindable
default
RightTemplate List<IInputGroupSideItem> Gets or sets the right side extension of the input group.
attribute
inner element
static value
bindable
default
Size Size Gets or sets the size of the input group.
attribute
inner element
static value
bindable
default
Default

Events

Name Type Description

Usage & Scenarios

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

https://getbootstrap.com/docs/4.1/components/input-group/

HTML Rendered by the Control

Sample 1: Basic Usage

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

The following controls are supported in these templates:

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

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

<bs:InputGroup Size="Small">
  <LeftTemplate>
    <bs:InputGroupCheckBox Checked="{value: Checked}" Changed="{command: UpdateText2()}" />
  </LeftTemplate>
  <ContentTemplate>
    <bs:InputGroupComboBox SelectedValue="{value: Text2}" DataSource="{value: Values}" />
  </ContentTemplate>
  <RightTemplate>
    <bs:InputGroupLiteral>Click the CheckBox on the left.</bs:InputGroupLiteral>
  </RightTemplate>
</bs:InputGroup>
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; } = "a";
    public string[] Values { get; set; } = new string[] { "a", "b", "c" };

    public void UpdateText2()
    {
        Text2 = "b";
    }
}

Sample 2: Multiple Controls in the InputGroup

You can also place multiple controls in the LeftTemplate and RightTemplate properties.

<bs:InputGroup>
  <LeftTemplate>
    <bs:InputGroupRadioButton CheckedItem="{value: Color}" CheckedValue="r" Text="R" />
    <bs:InputGroupRadioButton CheckedItem="{value: Color}" CheckedValue="g" Text="G" />
    <bs:InputGroupRadioButton CheckedItem="{value: Color}" CheckedValue="b" Text="B" />
  </LeftTemplate>
  <ContentTemplate>
    <bs:InputGroupTextBox Text="{value: Color}"/>
  </ContentTemplate>
  <RightTemplate>
    <bs:InputGroupButton Text="Button 1" />
    <bs:InputGroupButton 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