Checkbox not showing checked

1 Answer 469 Views
Checkbox
S
Top achievements
Rank 1
S asked on 18 Apr 2023, 10:47 PM

I upgrade from 'telerik.ui.for.aspnet.core.2019.1.220.commercial' to 'telerik.ui.for.aspnet.core.2023.1.117.commercial' and now the check box doesn't display check even though the data from the database is true

@(Html.Kendo().CheckBox() .Name("MyCheckbox").Label("Yes")

I even tried @(Html.Kendo().CheckBox() .Name("MyCheckbox").Checked(true).Label("Yes"), it still won't show the checkbox as checked.

Regards

 

S
Top achievements
Rank 1
commented on 21 Apr 2023, 08:16 PM

I used checkbox:

 

<div class="col-md-2">
 <label for="MyCheckBox">Is this an Invasive Species?</label><br />
 @(Html.Kendo().CheckBoxFor(m => m.Checked).Label("MyCheckBox"))
</div>

but now I am getting:

VM1552:1  Uncaught TypeError: jQuery(...).kendoCheckBox is not a function
    at <anonymous>:1:49
    at Object.n [as syncReady] (kendo.aspnetmvc.js:785:11)
    at <anonymous>:1:7
    at DOMEval (jquery.js:111:12)
    at domManip (jquery.js:5762:8)
    at jQuery.fn.init.append (jquery.js:5898:10)
    at jQuery.fn.init.<anonymous> (jquery.js:5992:18)
    at access (jquery.js:3939:8)
    at jQuery.fn.init.html (jquery.js:5959:10)
    at Object.<anonymous> (site.js:61:36)

1 Answer, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 21 Apr 2023, 08:32 PM

Hi,

At first glance, I did not see anything apparent within the CheckBox configuration that could potentially cause the sporadic behavior from persisting.

In this regard, I have further tried reproducing the behavior within an isolated sample whilst producing the following result:

Notice that I have tested with two Checkboxes. One by using the conventional HtmlHelper and the other using the <WidgetName>For Helper. For example:

@(Html.Kendo().CheckBox()
    .Name("MyCheckbox")
    .Checked(true)
    .Label("Yes")
)


@(Html.Kendo().CheckBoxFor(m => m.Checked))
 Where the second CheckBox is bound to the following model:
public class CheckBoxModel
{
    public bool Checked { get; set; } = true;
}

I tried further reciprocating the issue and noticed that the same behavior would be present if the client-side resources are not corresponding to the version of the NuGet package.

Generally, upgrading through the NuGet Package Manager will not update the included client-side files. Therefore, you will need to upgrade the files manually in order for the files to be up-to-date with the corresponding version of the NuGet package:

That being said, I recommend upgrading the included client-side files within the _Layout.cshtml of the application and observing whether the behavior persists. More information regarding the upgrade process is available within our documentation which can be found here:

<link href="https://cdn.kendostatic.com/2023.1.117/styles/kendo.bootstrap-main.min.css" rel="stylesheet" type="text/css" />
<script src="https://cdn.kendostatic.com/2023.1.117/js/jquery.min.js"></script>
<script src="https://cdn.kendostatic.com/2023.1.117/js/jszip.min.js"></script>
<script src="https://cdn.kendostatic.com/2023.1.117/js/kendo.all.min.js"></script>
<script src="https://cdn.kendostatic.com/2023.1.117/js/kendo.aspnetmvc.min.js"></script>

In addition, since you are doing a significant upgrade, I would recommend going over our breaking changes article, as they were inducted a significant amount of changes for a large portion of the Telerik UI for ASP.NET Core components:

Notice that the yearly release changes are located on the left-hand side:

That being said, I noticed that there is no license associated with your account which further limits our support service.

Thus, I strongly recommend that you either purchase or renew your license in order to gain access to the latest updates, fixes, features, and support regarding the Telerik UI for ASP.NET Core components. More information regarding the currently available plans can be reviewed here:

Nevertheless, attached you will find a runnable sample that was used for further testing purposes. If possible, could you please consider replicating the behavior within the attached sample and send it back for further examination if the mentioned above suggestion does not help?

Kind Regards,
Alexander
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Checkbox
Asked by
S
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Share this question
or