0

I have simple SelectList in my ActionResult:

ViewBag.ItemId = new SelectList(db.Items, "ItemId", "Name");

I'd like to show the item name with the item Specification

This is not working:

ViewBag.ItemId = new SelectList(db.Items, "ItemId", "Name" + "Specification");

Is there is an easy way to do this?

khorshid
  • 59
  • 2
  • 10
  • use `db.Items.Select(x => new SelectListItem{ Value = x.Id.ToString(), Text = x.Name + " " + x.Specification })` –  Jan 15 '18 at 07:27
  • Thanks! My question is duplicate, but I think the answer is differ. Thanks again – khorshid Jan 15 '18 at 07:46

0 Answers0