Telerik Forums
UI for ASP.NET Core Forum
1 answer
58 views

I'm just starting to catalog the issues list, but I'm immediately noticing that any markup passed to non-template areas has ceased rendering.

For example:

 

<div class="demo-section">
    @(Html.Kendo().Switch()
                .Name("switch")
                .Messages(c => c.Checked("<span>YES</span>").Unchecked("<span>NO</span>"))
    )
</div>

used to render the markup vs displaying the markup text. Now it spits it out.

I have used similar techniques in Grid commands as well, which are all also broken. Basic custom commands I can work around by using the .Template option instead of .Text, but for an Edit's UpdateText and CancelText, I cannot find a workaround that isn't completely unbearable to manage at anything remotely near scale.

Is there a workaround or option to re-enable rendering HTML in these places I am simply not seeing? 

Also, this feels like a pretty significant change to bury inside of a generic "rendering mismatch" (which may not even be referring to this, but I cannot find anything in the breaking changes mentioning something like this change). If there's not an effective way to get back to this functionality, it's going to potentially cost me days/weeks to find a tenable solution.

Ivaylo
Telerik team
 answered on 22 Nov 2024
0 answers
463 views

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>

Jordan
Top achievements
Rank 1
Iron
 asked on 28 Dec 2022
1 answer
673 views
I have a switch that I would like to bind to a model, is this possible?     
Mihaela
Telerik team
 updated answer on 25 Jul 2022
1 answer
1.6K+ views

Hi, I'm new to Telerik ASP.NET Core, so maybe this is a simple task. I'm using Razor Pages and would like to hide the label from one field, how can this be done? From the switch field.

Thanks,

Humberto

                    @(Html.Kendo().Form<ProfileModel>()
                            .Name("formExample")
                            .FormData(Model?.Input)
                            .HtmlAttributes(new { method = "POST" })
                            .Layout("grid")
                            .Grid(g => g.Cols(1).Gutter(0))
                            .Items(items => {
                                items.AddGroup()
                                    .Label("Security")
                                    .Layout("grid")
                                    .Grid(g => g.Cols(2))
                                    .Items(i =>
                                    { 
                                        i.Add()
                                            .Field(f=> f.TFA)
                                            .Editor(e => e.Switch());
                                });

                            })
                            .Validatable(v =>
                            {
                                v.ValidateOnBlur(false);
                                v.ValidationSummary(false);
                                v.ErrorTemplate("<span style='color: red'>#:message#</span>");
                            })
                    )                

Petar
Telerik team
 answered on 15 Feb 2022
1 answer
196 views

I'm having trouble accessing switches in a grid column.  I want to loop through them and toggle them on after clicking a toolbar button.

The click event is working.  But getting 'undefined' on 'switchInstance ':

 

Column with switches code:

.Columns(columns =>
        {

         columns.Bound(p => p.Exempt).Width(100).Filterable(ftb => ftb.Multi(true)).Sortable(false).ClientTemplate(
                "<input class='exemptSwitch' id='exemptSwitch' \\#if (Exempt) { \\# checked='checked' \\# } \\# type='checkbox' />");

})

 

Toolbar button code:

.ToolBar(toolBar =>
        {
            toolBar.Custom()
                .Name("EnableAllFiltered")
                .Text("Enable All Filtered")
                .IconClass("k-icon k-i-play")
                ;

 })

 

Click event code:

$(function () {
    $(".k-grid-ExemptAllFiltered", "#SubscriberGrid").on("click", function (e) {   <--- click of custom grid header toolbar button

         $("#SubscriberGrid .exemptSwitch").each(function () {
               var switchInstance = $(this).data("kendoSwitch");
               switchInstance.enable(true);
          });

});

 

Any assistance would be greatly appreciated!

 

Jon

Tsvetomir
Telerik team
 answered on 20 Oct 2020
2 answers
403 views

How can I set the checked/unchecked messages for my entire application or at least for the page?

Currently, I use something like:

<kendo-switch for="BoundProperty" checked="Model.BoundProperty"><messages checked="@Html.T("Common.YES")" unchecked="@Html.T("Common.NO")" /></kendo-switch>

 

It would be great if I didn't have to include the <messages /> tag each time.

Barry
Top achievements
Rank 1
 answered on 03 Jun 2020
2 answers
437 views

Hello,

I try to change the background color regarding ON or OFF without success (note that .k-switch and .k-switch-handle works perfectly) :

 

<style>
    .k-switch {
        font-size: 12px !important;
    }
    .k-switch-on  {
        background-color: green !important;
    }
    .k-switch-off  {
        background-color: red !important;
    }
    .k-switch-handle{
        background-color: chocolate !important;
    }
</style>

 

Thank you for your precious help.

Louis
Top achievements
Rank 1
Iron
Iron
Iron
 answered on 09 Oct 2019
1 answer
110 views

The same switch control in windos10 system,it can be slide drag:

press the block and drag,if it is samll distance,release the mouse,the block will go back,otherwise the distance exceed 30%-50%

 

 

Dimitar
Telerik team
 answered on 01 May 2019
Narrow your results
Selected tags
Tags
+115 more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?