In my controller I have this:
ViewData["maskList"] = new SelectList(equipmentRepository.GetMasks(), "Id", "DisplayName");
and then I bind it to my view using
<div each="var nfa in mfa.NasalFittingAssessment">
${Html.DropDownList("NasalMaskTypeId", ViewData["maskList"] as IEnumerable<System.Web.Mvc.SelectListItem>, new { class = "ddl" })}
</div>
Note that I'm using the spark view engine so this DropDownList is getting rendered to the page via a loop. This means that the selected value of the dropdown list will change on each iteration of the loop.
What I can't work out is how to pass in the value I want to set the DropDownList to based on the value that is currently being rendered to the screen.