Html.Kendo().Switch() rendering as checkbox in a grid column

0 Answers 259 Views
Grid Switch
Jordan
Top achievements
Rank 1
Iron
Jordan asked on 28 Dec 2022, 02:01 PM

How comes this is displaying a checkbox?   This is an ASP.NET CORE app.  I do have the mobile CSS included (not sure if that is required)

Here is the column and template.   It simply renders as a checkbox.

columns.Bound("").ClientTemplateId("switchTemplate");
<script id="switchTemplate" type="text/x-kendo-template">
    <text>
            @(Html.Kendo().Switch()
                .Name("switch#=Id#")
                .Checked(true)
                .ToClientTemplate()
            )
    </text>
</script>

Georgi
Telerik team
commented on 02 Jan 2023, 08:33 AM

Hi Jordan,

Is it possible that your scripts are outdated? I've tested a similar configuration and it appears to work as expected, please check the following repl:

- https://netcorerepl.telerik.com/GdEvuwEW32JvhnYl46

Jordan
Top achievements
Rank 1
Iron
commented on 03 Jan 2023, 07:09 AM

I updated my scripts but it still does not work.  It works while the Editor is open but when it closed it goes to a checkbox.  It is very strange

Georgi
Telerik team
commented on 05 Jan 2023, 02:56 PM

Hi,

Could you please share your entire configuration with us? Including all event handlers.

In the meantime, you could try to use ClientTemplate instead as follows:

.ClientTemplate(
            @(Html.Kendo().Switch()
                .Name("switch#=Id#")
                .Checked(true)
                .ToClientTemplate()
            ).ToClientTemplate().Value
)

No answers yet. Maybe you can help?

Tags
Grid Switch
Asked by
Jordan
Top achievements
Rank 1
Iron
Share this question
or