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!
@(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!