I have some action for example
public ActionResult SomeAction(Model login)
{
.....
//Login fail
ModelState.AddModelError("loginError","Login fail");
if(!ModelState.IsValid)
{
//here i need send model
return RedirectToAction("SomeAction2","Controller");
}
return View(login);
}
SomeAction2 is not as same type Model as SomeAction. But SomeAction2 has a partial view that have same type with view SameAction. Can anyone tell me how I can send a model error to this partial view?
Just have to use
return View("ViewName");Then you can use a ViewBag collection to add the error messages.