Saving Kendo CheckBoxFor checked values separated by comma

2 posts, 0 answers
  1. RJ
    RJ avatar
    7 posts
    Member since:
    Mar 2016

    Posted 18 Apr 2016 Link to this post

    I have three checkboxes defined as below in my cshtml file:

                @(Html.Kendo().CheckBoxFor(e => e.Fruit)
                  <br />
                @(Html.Kendo().CheckBoxFor(e => e.Fruit)
                   <br />
                @(Html.Kendo().CheckBoxFor(e => e.Fruit)

    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?  
  2. Alex Gyoshev
    Alex Gyoshev avatar
    2515 posts

    Posted 20 Apr 2016 Link to this post

    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.

    Alex Gyoshev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top