Razor Page
This article demonstrates how to configure the Telerik UI Switch component for ASP.NET Core in a RazorPage.
For the full project with RazorPages examples, visit our GitHub repository.
@inject Microsoft.AspNetCore.Antiforgery.IAntiforgery Xsrf
@Html.AntiForgeryToken()
@(Html.Kendo().Switch()
.Name("switch")
.Checked(Model.IsChecked)
)
<kendo-switch name="switch" checked="Model.IsChecked"></kendo-switch>
[BindProperty]
public bool IsChecked { get; set; }
public void OnGet()
{
IsChecked = true;
}