I have a switch that I would like to bind to a model, is this possible?
1 Answer, 1 is accepted
1
Tsvetomir
Telerik team
answered on 28 May 2019, 01:15 PM
| edited on 25 Jul 2022, 10:55 AM
Hello,
If you would like to bind the Kendo UI Switch widget to a model, it means that you would have to make use of the SwitchFor() HtmlHelper. Here is how to bind it:
Controller which returns the view:
public IActionResult Index()
{
var model = new OrderViewModel() {
OrderID=1,
Discontinued = true
};
return View(model);
}
View:
@model Sample.Models.OrderViewModel
@(Html.Kendo().SwitchFor(m=>Model.Discontinued)
...
)
Let me know in case further assistance is needed.
Kind regards, Tsvetomir Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers.Learn More.