This is a migrated thread and some comments may be shown as answers.

Checkbox not working

4 Answers 1210 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 22 Jul 2015, 02:09 PM

Hi, I am using Kendo for ASP.Net MVC version 2015.2.264 using the Blue Opal theme.  I have a checkbox input which is not "checkable" when bound to a model property via the @CheckBoxFor razor syntax.  It renders correctly using the Kendo assigned theme, but does not allow you to check it even though it is not disabled.

 

This works:

     <div style="display:block;">
        <input type="checkbox" id="chkIntegrated" class="k-checkbox" name="Integrated">
        <label class="k-checkbox-label" for="chkIntegrated">Integrated 2</label> 
    </div>

 

 This does NOT work:

     <div style="display:block;">
        @Html.CheckBoxFor(Function(m) m.Integrated, New With {.class = "k-checkbox", .Id = "chkIntegrated"})
        @Html.LabelFor(Function(m) m.Integrated, New With {.class = "k-checkbox-label"})
    </div>

 

I have attached the test html page which illustrates this.  Any ideas? 

 

 

      

4 Answers, 1 is accepted

Sort by
0
eo
Top achievements
Rank 1
answered on 22 Jul 2015, 02:39 PM

Hello David,

Could you attach the model you're using as well as any other file used in the example?

0
David
Top achievements
Rank 1
answered on 22 Jul 2015, 04:28 PM
Hi eo - test project added ...
0
Accepted
Rosen
Telerik team
answered on 24 Jul 2015, 12:15 PM

Hello David,

I'm afraid that the k-checkbox-label class is not designed to work with Html.CheckBoxFor. This is due to the fact that Html.CheckBoxFor will render two input elements but the k-checkbox-label requires the associated input element to be immediately before the label. Thus, you should either skip the use of Html.CheckBoxFor and create the checkbox HTML manually or consider using UI for ASP.NET MVC CheckBox which should work correctly.

Regards,
Rosen
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
David
Top achievements
Rank 1
answered on 24 Jul 2015, 01:49 PM
OK, thanks Rosen.
Tags
General Discussions
Asked by
David
Top achievements
Rank 1
Answers by
eo
Top achievements
Rank 1
David
Top achievements
Rank 1
Rosen
Telerik team
Share this question
or