Hi team
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
- {
- new CheckBox {Text = "None"},
- new CheckBox {Text = "Vegetarian"},
- new CheckBox {Text = "Vegan"},
- new CheckBox {Text = "Halaal"}
- };
- return View(model);
- }
- // Model
- public List
Dietary_requirement = new List(); - public class CheckBox
- {
- public string Text { get; set; }
- public bool Checked { get; set; }
- }
- // View class
- class="row">
- ="Dietary Requirements">Dietary Requirements
class="input-group col-md-offset-3 col-sm-6 col-xs-6">class="input-group pull-left">- @Html.CheckBox("Vegetarian", false)
Ravi PatelPosted Mar 20, 2020, 3:25 AM
Amit MohantyPosted Mar 20, 2020, 2:58 AM