New to Kendo UI for jQuery? Start a free 30-day trial
Use MobileSwitch as Editor in Grid for MVC
Updated on Dec 10, 2025
Environment
| Product | Progress® Telerik® UI Grid for ASP.NET MVC |
| Product Version | 2017.2 504 |
| Preferred Language | C Sharp |
| MVC Version | MVC 5 |
| View Engine | Razor |
Description
Howe can I display a MobileSwitch when the Grid is in an edit mode?
Suggested Workarounds
The Kendo UI Grid does not provide a built-in solution for achieving this behavior. However, you can still work around this issue.
By default, the MobileView does not support the usage of a MobileSwitch but you can use it as an editor within the Grid by applying the following approach:
-
Create a new partial view for the MobileSwitch editor in the
Views/Shared/EditorTemplatesfolder. For the example, name itMobileSwitchTemplate.cshtml.js@model bool <input type="checkbox" data-bind="value: @Html.ViewData["FieldName"].ToString()" class="mySwitch"/> -
Specify the template and pass the field name in
ViewDatafor the column you want to use that editor. Copy the following code:jscolumns.Bound(p => p.Discontinued).Width(120).EditorTemplateName("MobileSwitchTemplate").EditorViewData(new { FieldName = "Discontinued" }); -
Initialize the MobileSwitch within the
editevent of the Grid.js.Events(ev=>ev.Edit("onEdit")) ... <script type="text/javascript"> function onEdit(e) { $(".mySwitch").kendoMobileSwitch(); }