Click here to Skip to main content
15,664,506 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a checkboxList which is retrieve from the table of Property.
In save products, I have saved the checked of checkboxList in Product Table.
In edit products page, I want this checkbox list to be checked depending on the db values.

Share this answer
public class CheckBoxItem
   public string Code { get; set; }
   public bool IsChecked { get; set; }
   public string Label {get;set;}

<p class="checkbox" style="display:inline">
<span style="margin-left:5px;">
    @Html.HiddenFor(x => x.Code)           
    @Html.CheckBoxFor(x => x.IsChecked)
@Html.LabelFor(x => x.IsChecked, Model.Label)

see the ref.
Inputting selected checkboxes not working in MVC and Razor[^][^]
Share this answer
/\jmot 11-Feb-15 10:39am    
:Psomeone just downvote my answer.
so, please tell me why??? did the ans wrong??
if you plese tell me, then it'll help me alot.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900