I’d like to display 2 SelectList in one View. So obviously, I can only use 1 ActionResult to render the view.
public ActionResult IndexStudents(Docent docent, int lessonid, int classid)
{
return View(new SelectList(docent.ReturnStudentsNormalAsString(lessonid, classid)));
return View(new SelectList(docent.ReturnStudentsNoClassAsString(lessonid, classid)));
}
But of course, this does not work. How could I fix it? Maybe making use of a Dictionary?
I want my output look like this:
<div class="editor-field">
<%: Html.DropDownList("IndexStudentsNormal",
Model as SelectList) %>
</div>
<div class="editor-field">
<%: Html.DropDownList("IndexStudentsNoClass",
Model as SelectList) %>
</div>
So I’d like to use 2 models, one for each selectlist… one with normal students and one with students who are not subscribed for lessons.
How could I do that?
You need to define a model with two SelectLists: