html helper
<a href="#@i.EmpID,new{[email protected]}" onclick="">@i.Namea>controller
public ActionResult addMaster(MasterNode master,int? id) {
try { if (ModelState.IsValid) { using ( TestDemoEntities db = new TestDemoEntities()) { var newMaster = db.MasterNodes.Create(); newMaster.Name = master.Name; newMaster.HasEmployees =master.HasEmployees; newMaster.ReportsTo = id.Value; newMaster.Description = master.Description; db.MasterNodes.Add(newMaster); db.SaveChanges(); return RedirectToAction("Index", "Treeview"); } } else { ModelState.AddModelError("","Data is not correct"); } } catch(Exception e) { throw;
} return View();
i want to set EmpID as value for the reportsTo
kalu singh raoPosted Jul 18, 2016, 8:58 AM