ASP.NET Core CheckBoxGroup Overview
The CheckBoxGroup is part of Telerik UI for ASP.NET Core, a
professional grade UI library with 110+ components for building modern and feature-rich applications. To try it out sign up for a free 30-day trial.
The Telerik UI CheckBoxGroup TagHelper and HtmlHelper for ASP.NET Core are server-side wrappers for the Kendo UI CheckBoxGroup widget.
The CheckBoxGroup allows to style and provide checkbox functionality to list elements, set the position of the labels, attributes and custom css classes.
Initializing the CheckBoxGroup
The following example demonstrates how to define the CheckBoxGroup.
@(Html.Kendo().CheckBoxGroup()
.Name("checkboxgroup")
)
<kendo-checkboxgroup name="checkboxgroup"
input-name="checkboxItem">
</kendo-checkboxgroup>
Basic Configuration
The following example demonstrates the basic configuration for the CheckBoxGroup.
@(Html.Kendo().CheckBoxGroup()
.Name("checkboxgroup")
.Items(i =>
{
i.Add().Label("Spain").Value("1");
i.Add().Label("Italy").Value("2");
i.Add().Label("UK").Value("3");
})
.Value(new string[] { "1" })
)
<script>
$(function() {
// The Name() of the CheckBoxGroup is used to get its client-side instance.
var checkboxgroup = $("#checkboxgroup").data("kendoCheckBoxGroup");
});
</script>
@{
var data = new string[]{ "1" };
}
<kendo-checkboxgroup name="checkboxgroup"
value="data" >
<kendo-checkboxgroup-items>
<kendo-checkboxgroup-item value="1" label="Spain"></kendo-checkboxgroup-item>
<kendo-checkboxgroup-item value="2" label="Italy"></kendo-checkboxgroup-item>
<kendo-checkboxgroup-item value="3" label="UK"></kendo-checkboxgroup-item>
</kendo-checkboxgroup-items>
</kendo-checkboxgroup>
Functionality and Features
-
Binding—You can bind the CheckBoxGroup's items by using its
Items
configuration method or theBindTo
method to bind to a view model. - Label—The CheckBoxGroup allows you to customize the text and appearance of its labels.
-
Layout—The CheckBoxGroup supports two types of layout -
horizontal
andvertical
.
Next Steps
- Getting Started with the CheckBoxGroup
- Basic Usage of the CheckBoxGroup HtmlHelper for ASP.NET Core (Demo)