Telerik Forums
UI for ASP.NET MVC Forum
2 answers
61 views

(edit: I didn't initially realize this was being posted in the UI for jQuery forum and have since duplicated in the .net core forum - feel free to remove this one if deemed inappropriate for this forum)

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.

Josh
Top achievements
Rank 1
Iron
 updated answer on 27 Nov 2024
0 answers
577 views

Hi,

I have this code here inside the form and only code for the switch(), : 


<div class="create-section">
    @(
        Html.Kendo().Form<WeighmoreSouth32Web.Models.Role>()
            .Name("createForm")
            .HtmlAttributes(new { action = "Create", method = "POST" })
            .Validatable(v =>
            {
                v.ValidateOnBlur(true);
                v.ValidationSummary(vs => vs.Enable(true).TemplateId("validation-message"));
            })
            .Items(itemGroup =>
            {
                itemGroup.AddGroup().Layout("grid").Grid(g => g.Cols(3).Gutter(20)).Label("Role Info").Items(items =>
                {
                items.Add()
                .Field(f => f.RoleName)
                .Label(l => l.Text("Role Name"));
                items.Add()
                .Editor(e => e.Switch().Name("AddCustomer")).Field(f => f.AddCustomer)
                .Label(l => l.Text("Role Name*:"));
            });
        })

        )
   

</div>

 it is working fine for the textbox input but when I use switch to pass the true value it is passing it two times one true and other one false. But it does not do the same when switch is off, only passes the false value. Here is a picture of it. I did also tried some Js/Jquery code to bind it but it didn't worked as well. Please help. 

 

Rikki
Top achievements
Rank 1
 updated question on 26 Sep 2022
0 answers
875 views

I have a switch control, placed inside of a tab control, in a client detail template, as part of a grid.

I need to bind the switch checked property, to a value stored in the grids dataset, which is a Boolean. However, the code causes the error:-

Preprocessor directives must appear as the first non-whitespace character on a line

The code is:-

<script id="subsubdetailsTemplate" type="text/kendo-tmpl">

@(Html.Kendo().TabStrip().Name("Tabstrip_#=ReportID#")
         .Items(i =>
         {

         i.Add().Text("Report Details").Selected(true).Content(@<text>


    <div>

    <p> #=HideOnCatalogue#</p>

    Hide from Catalogue?:
     @(Html.Kendo().Switch()
                    .Name("switch_#=ReportID#")
                    .Events(e => e.Change("function(e){ switchChange(e, '#=ReportID#')}"))
        .Checked(#=HideOnCatalogue#)
        .Messages(c => c.Checked("YES").Unchecked("NO"))
        .ToClientTemplate()
    )


    </div>
    </text>);

       



         }).ToClientTemplate())


</script>

How can I bind the value to the switch?  I can display the value in a <p> tag without a problem, as well as passing the report ID to the function called when the switch is clicked.

Thanks

AP
Top achievements
Rank 1
Iron
Iron
Veteran
 asked on 24 Feb 2022
2 answers
225 views

Hi,

I have one table

Emplpyee

..................

Id   Name    Active

1     a                 1

2     b                0

 

my requirement is that

i have one toggle button (by default select Yes(1)) 

based upon that values load grid records

once i change that value to No then display records based upon that

can you please provide me sample code for this one

Yanislav
Telerik team
 answered on 09 Nov 2021
1 answer
197 views

I have multiple switches on a page, each switch has the same class assigned to it.

What i need is that if any switch is checked / changed i need an event to fire and also need to check the state of the remaining switches.

@(Html.Kendo()
    .SwitchFor(a => a.IsAdmin)
    .HtmlAttributes(new { @class = ".permissions" })
    .Messages(c => c.Checked("YES").Unchecked("NO")))

I have tried numerous jquery approaches but none of them even fire when the switch is toggled.


    $('body').on('change', '.permissions', function () {
        // this event handler never gets trigged.....
        // get an instance of each switch and get the toggled / checked state.
        alert();
    });

Patrick
Top achievements
Rank 1
Iron
 answered on 24 Sep 2021
1 answer
428 views
Is there a way I can affect the text color for the checked state of the switch without hacking the theme. through htmlattributes or something like that. I want in in one place not globally.
Petar
Telerik team
 answered on 24 Aug 2021
1 answer
124 views

I have a case where i need to dynamically clone the switch control and use it.
 Im able to clone the switch but the script still refers to the original control .

Tried changing  the id and name properties but still not able to achieve it .

Can anyone let me know how to do it .(FYI im not using mobileswitch)

Thanks in advance.

Anton Mironov
Telerik team
 answered on 12 Aug 2021
2 answers
1.0K+ views

First time working with this control and not sure what I'm missing.

Code:

 

                        @(Html.Kendo().SwitchFor(model => model.IsEnabled)
                            .Messages(c => c.Checked("Enabled").Unchecked("Disabled"))
                            )

 

The switch shows up and works, but the true and false message labels do not appear.

 

Responsive
Top achievements
Rank 1
Veteran
 answered on 26 Aug 2020
3 answers
382 views

Hi,

 

Any idea how to reset the theming to another thema (default) ?

 

Currently I'm using the 'material v2' theme

 

Best regards

Dimitar
Telerik team
 answered on 25 Jun 2020
3 answers
350 views

I have a form with a couple of switchfor controls on them. They are bond to Boolean properties of my model. When calling a reset on the form, these controls do not revert back to the original value as expected.

 

<div class="col-1">
                        <div class="form-group">
                            <label asp-for="DoNotContact">Ne pas contacter</label><br />
                            @(Html.Kendo().SwitchFor(m => m.DoNotContact)    )
             </div>

 </div>

What am I doing wrong?

 

 

 

Nikolay
Telerik team
 answered on 28 May 2020
Narrow your results
Selected tags
Tags
+? 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?