I'm doing a professional registration and of course, my View is typed with this Model. However in the register I need to insert Specialization and Type (2 different models). These last 2 models need to come as lists and appear in checkboxes within a Select (HTML).
So far I have the following:
public ActionResult Create()
{
ProfessionalSpecializationDAO pSpecializationDAO = new ProfessionalSpecializationDAO();
ViewBag.ListProfessionalSpecialization = pSpecializationDAO.ListProfessionalSpecialization(0);
ProfessionalTypeDAO pTypeDAO = new ProfessionalTypeDAO();
ViewBag.ListProfessionalType = pTypeDAO.ListProfessionalType(0);
return View();
}
View (HTML):
<div class="editor-field">
@{
ViewBag.ProfessionalSpecialization as List<ProfessionalSecialization>;
foreach (var item in ViewBag.ProfessionalSpecialization)
{
Html.CheckBoxFor(modelItem => item.Title);
}
Html.ValidationMessageFor(model => model.IdProfessionalSpecialization);
}
</div>
Probably must be why it's missing reference to Model ProfessionalSpecialization
. I do not know how to reference them.