I cant seem to make my checkbox to access my model fields and actionResult List that i have created.Please help me to improve my logic better, see this here below;
- public ActionResult DietReq()
- {
- EditTrainingRegFormViewModel model = new EditTrainingRegFormViewModel();
-
- model.Dietary_requirement = new List<CheckBox>
- {
- new CheckBox {Text = "None"},
- new CheckBox {Text = "Vegetarian"},
- new CheckBox {Text = "Vegan"},
- new CheckBox {Text = "Halaal"}
- };
-
- return View(model);
- }
-
-
- public List<CheckBox> Dietary_requirement = new List<CheckBox>();
- public class CheckBox
- {
-
- public string Text { get; set; }
- public bool Checked { get; set; }
-
-
- }
-
-
- <div class="row">
- <label for="Dietary Requirements">Dietary Requirements</label>
- <div class="input-group col-md-offset-3 col-sm-6 col-xs-6">
- <div class="input-group pull-left">
-
- @Html.CheckBox("Vegetarian", false)
- </div>
-
- </div>
-
- </div>