List<string> Name = new List<string>();
namespace newNSMS.Areas.Ministries.Models { public class Category { public List<string> Name = new List<string>(); } public class getMethods { public static Category getState(Category d) { try { string countCode = "Nig"; char[] chars = { ',' }; testStealthServ.countries csd = new testStealthServ.countries(); List<string> sth = csd.getStates(countCode).ToList<string>(); foreach (var v in sth) { string[] splits = v.Split(chars); d.pID += splits.ElementAt(1); d.pName += splits.ElementAt(0); d.Name.Add(splits.ElementAt(0)); d.ID.Add(splits.ElementAt(1)); } return d; } catch (Exception ex) { throw ex.InnerException; } } } }
public ActionResult MinistriesHome() { Category c = new Category(); getMethods.getState(c); return View(c); }
<div class="col-sm-10"> @Html.DropDownList("schlreg", (SelectList)Model => Model.Name, null, new { @class = "Category" }) </div>
@Html.DropDownList("mylist", new SelectList(Model.Name))
@Html.Partial("~/Views/dropdown.cshtml", model)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)