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

Model Binding

You can bind a Telerik UI RadioButton to a model.

  1. Create a new action method and pass the instance of the model to the View.

    public class RadioButtonModel
    {
        public bool IAgreeProp { get; set; }
    }
    
    public partial class ButtonController : Controller
    {
        public ActionResult RadioButton()
        {
            RadioButtonModel myModel = new RadioButtonModel() { IAgreeProp = false };
            return View(myModel);
        }
    }
    
  2. Make your view strongly typed.

    @model Kendo.Mvc.Examples.Controllers.RadioButtonModel
    
  3. Add two RadioButtons and set the Boolean values for the checked state through the .Value setting. The matched Boolean value from model will define the initial checked state.

    The following example demonstrates how the radio button with the I Disagree label will be checked because its false value matches the model value.

        @(Html.Kendo().RadioButtonFor(m => m.IAgreeProp).Label("I Agree").Value(true))
        @(Html.Kendo().RadioButtonFor(m => m.IAgreeProp).Label("I Disagree").Value(false))
    

See Also

In this article