I need a dropdownlist to be populate with a simple list of numbers. I’m not sure if I can do this without having to create a new SelectList since it’s just numbers.
@Html.DropDownListFor(model => model.NumberPassengers, new SelectList(Model.NumberPassengers))
Really not sure what to do in my model:
public int[] Passengers = { 1, 2, 3, 4, 5, 6 };
you need to create a new List of
SelectListItem. I normally then drop this in the ViewBag for things liek this because you don’t want it back. Then bind it to your aDropDownListForcontrol, here’s one I’ve done for times:then
Then