yash patel

yash patel

  • 1.4k
  • 286
  • 21.4k

object refrence is required for the non static field

Oct 2 2020 5:30 AM
public ActionResult SignUp( UserBO objUserBO )
{
if (ModelState.IsValid)
{
UserBL objUserBL = new UserBL();
if(objUserBO.UserId >= 1)
{
nsrouteEntities.Entry(objUserBL).State = EntityState.Modified;
}
else
{
CustomBO objCustomBO = objUserBL.AddUser(objUserBO);
return View("Login");
}
}
return View(objUserBO);
}
   
for the bold part the below error is coming
 
object reference is required for the non static field,method or property
 
the form is opening properly but when we submit the form it is adding a new record instead of upadating the existing record 

Answers (3)