I am returning some stored contacts to view for DropDownList and I am not able to include multiple dataTextFields on my SelectList.
Currently I have:
@Html.DropDownListFor(model => model.Account.AccountContacts,
new SelectList(ViewBag.DDContacts, "Contact.ContactID", "Contact.FirstName"),
new { @class = "select", style = "width: 100px;" })
I would like to have:
@Html.DropDownListFor(model => model.Account.AccountContacts,
new SelectList(ViewBag.DDContacts, "Contact.ContactID", "Contact.FullName"),
new { @class = "select", style = "width: 100px;" })
which combines both FirstName and LastName properties.
UPDATE: I am aware of extending contact property, I was curious was there a streamline way to accomplish this in the View or Controller. I tried the two solutions here to no avail. How can I combine two fields in a SelectList text description?