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

Saving Kendo CheckBoxFor checked values separated by comma

1 Answer 207 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
RJ
Top achievements
Rank 1
RJ asked on 18 Apr 2016, 05:52 PM
I have three checkboxes defined as below in my cshtml file:


            @(Html.Kendo().CheckBoxFor(e => e.Fruit)
                 .Name("FruitApple")
                 .Label("Apple"))
              <br />
            @(Html.Kendo().CheckBoxFor(e => e.Fruit)
                  .Name("FruitBanana")
                  .Label("Banana"))
               <br />
            @(Html.Kendo().CheckBoxFor(e => e.Fruit)
                  .Name("FruitCherry")
                  .Label("Cherry"))


Where Fruit is the property which is defined in my model class as below:  

       public string Fruit { get; set; }

I want all the checked checkboxes label text to be separated by comma and assigned as string value to my property 'Fruit'. 
For eg: If checkbox for Apple and Cherry is checked. I want to assign Fruit as Apple, Cherry.

But when I run my code, property Fruit is empty.  
  
How can I get this behavior?  
  
Thanks!

1 Answer, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 20 Apr 2016, 08:14 AM

Hello RJ,

The CheckBoxFor method provides a styled alternative to the Html.CheckBoxFor checkbox. Can you provide the code that works in your scenario with Html.CheckBoxFor (without using the Kendo UI extensions)? If it works with the standard extension, it should work with the Kendo UI ones.

Regards,
Alex Gyoshev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
General Discussions
Asked by
RJ
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Share this question
or