Normally I would bind data to a DropDownListFor
with a SelectList
:
@Html.DropDownListFor(model => model.CustomerId, new SelectList(Model.Orders, "OrderId", "ItemName"))
Is there any way to do this through strongly-typed lambdas and not with property strings. For example:
@Html.DropDownListFor(model => model.CustomerId, new SelectList(Model.Orders, x => x.OrderId, x => x.ItemName))