public ActionResult Index() { var ListItms = dl.BindItems(); List<SelectListItem> items = new List<SelectListItem>(); foreach (var itms in ListItms) { SelectListItem s = new SelectListItem(); s.Text = itms.ItemCode.ToString(); s.Value = itms.ItemName.ToString(); items.Add(s); } ViewBag.Campaign = items; return View();
@using (Html.BeginForm("Index", "Testing")) { @Html.DropDownList("ItmName", new SelectList(ViewBag.Campaign, "Value", "Text")) }
@Html.DropDownList("ItmCode", new SelectList(ViewBag.Campaign, "Text", "Value"))
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)