New to Telerik UI for ASP.NET Core? Download free 30-day trial

Binding

When using the Tag helpers you can bind the checkbox items by using the <kendo-checkboxgroup-items> tag or the bind-to() method.

Items method

The example below demonstrates how to use the <kendo-checkboxgroup-items> tag to configure the checkboxes in the CheckBoxGroup widget.

   <kendo-checkboxgroup name="checkboxgroup">
        <kendo-checkboxgroup-items>
            <kendo-checkboxgroup-item value="one" label="First">
            </kendo-checkboxgroup-item>
            <kendo-checkboxgroup-item value="two" label="Second">
            </kendo-checkboxgroup-item>
        </kendo-checkboxgroup-items>
    </kendo-checkboxgroup>

BindTo method

You can configure the items in the CheckBoxGroup widget by using the BindTo method.

  1. Pass the data to the view through the view model.

    public IActionResult Index()
    {
        var itemsList = new List<InputGroupItem>()
        {
            new InputGroupItem()
            {
                Label = "Yes",
                Value = "one"
            },
             new InputGroupItem()
            {
                Label = "No",
                Value = "two"
            },
              new InputGroupItem()
            {
                Label = "N/A",
                Value = "three"
            }
        };
    
        return View(new CheckBoxGroupViewModel() { Items = itemsList });
    }
    
    public class CheckBoxGroupViewModel
    {
        public List<InputGroupItem> Items { get; set; }
    }
    
  2. Add the CheckBoxGroup to the view and bind it to a property of the view model.

    @model MvcApplication1.Models.CheckBoxGroupViewModel
    
    <kendo-checkboxgroup name="checkboxgroup"
                  input-name="checkboxItem"
                  bind-to="Model.Items">
    </kendo-checkboxgroup>
    

See Also

In this article
Not finding the help you need? Improve this article