// // GET: /CERLMenu/Details/5 public ActionResult Details(int id = 0) { vCERLMenu vcerlmenu = db.vcerlmenu.Find(id); if (vcerlmenu == null) { return(HttpNotFound()); } return(View(vcerlmenu)); }
protected void InitDDL(string ddlName, vCERLMenu vcerlmenu, string Type) { int parentMenuId = 0; parentMenuId = (vcerlmenu != null ? int.Parse(vcerlmenu.parentMenuId.ToString()) : -1); string[] CERLMenuArray = { "CERLMenuList" }; var initlist = Enumerable.Empty <object>().Select(r => new { Id = 0, Name = "" }).ToList(); if (CERLMenuArray.Contains(ddlName)) { initlist = edb.FnCERLMenuDropDownList("0").ToList().Select(x => new { Id = int.Parse(x.Id.ToString()), Name = x.Name }).ToList(); } List <SelectListItem> initList = new List <SelectListItem>(); if (!(Type == null || Type.Trim().Length == 0)) { initList.Add(new SelectListItem() { Text = "", Value = "" }); } string selectedvalue = ""; if (vcerlmenu != null) { switch (ddlName) { case "CERLMenuList": selectedvalue = parentMenuId.ToString(); break; default: break; } } foreach (var item in initlist) { initList.Add(new SelectListItem() { Text = item.Name, Value = item.Id.ToString(), Selected = (item.Id.ToString() == selectedvalue) }); } SelectList cList = new SelectList(initList, "Value", "Text"); ViewData[ddlName] = cList; Session[ddlName] = cList; }
// // GET: /CERLMenu/Edit/5 public ActionResult Edit(int id = 0) { vCERLMenu vcerlmenu = db.vcerlmenu.Find(id); if (vcerlmenu == null) { return(HttpNotFound()); } InitDDLShow(vcerlmenu, "Edit"); return(View(vcerlmenu)); }
protected void InitDDLShow(vCERLMenu vcerlmenu, string action) { InitDDL("CERLMenuList", vcerlmenu, action); }