Star
8089 Points
2778 Posts
Jul 18, 2018 10:44 AM|vahid bakkhi|LINK
you should define the ViewBag in your Post Action
[HttpPost] [ValidateAntiForgeryToken] public ActionResult LeaveMapping(CompanyViweModel model) { try { ViewBag.company = HttpContext.Session.GetInt32("companyid"); ViewBag.companyname = HttpContext.Session.GetString("companyname"); ViewBag.leavetype = _listrepository.GetLeaveType(); tb_company_leave_master compamnylv = new tb_company_leave_master(); compamnylv.num_days = model.num_days; compamnylv.num_leave_type = model.num_leave_type;
my mean the highlighted line
Star
8089 Points
2778 Posts
Re: Error on post Back
Jul 18, 2018 10:44 AM|vahid bakkhi|LINK
you should define the ViewBag in your Post Action
[HttpPost] [ValidateAntiForgeryToken] public ActionResult LeaveMapping(CompanyViweModel model) { try { ViewBag.company = HttpContext.Session.GetInt32("companyid"); ViewBag.companyname = HttpContext.Session.GetString("companyname"); ViewBag.leavetype = _listrepository.GetLeaveType(); tb_company_leave_master compamnylv = new tb_company_leave_master(); compamnylv.num_days = model.num_days; compamnylv.num_leave_type = model.num_leave_type;
my mean the highlighted line
Please MARK AS ANSWER if suggestion helps.