html helper
<a href="#@i.EmpID,new{[email protected]}" onclick="">@i.Name</a>
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)
catch
{
throw;
return View();
i want to set EmpID as value for the reportsTo