Scenario :
I have two controllers say Home Controller and Security Controller. My Home Controller View..Index is having Login Control {TextBoxex and Button}; Now My code in Index View of Home Controller is :
@using (Html.BeginForm("CheckLogin", "Security", FormMethod.Post))
And the code in Security Controller is :
/* Security Controller */
[HttpPost]
public ActionResult CheckLogin(LoginModel login)
{
if (ModelState.IsValid)
{
if ((login.UserName.ToUpper() == "ADMIN") && (login.Password.ToUpper() == "NIMDA"))
{
//Do further Redirection
}
else
{
//Here I want to return to Index View of Home Controller and get error displayed
what i have kept in ModelState.AddModelError(""); method
}
}
}
Now I want to display error message from Security controller to Index View of Home Controller with Error Message that Invalid Login or Validation Summary......
Loading

Jaganathan BantheswaranPosted Feb 25, 2014, 6:01 AM
Lakshmanan Sethu SankaranarayanPosted Feb 25, 2014, 1:32 AM
Mayur DhavlePosted Feb 25, 2014, 1:19 AM
Thank you very much for replying to this thread. I would be happy if you could send me a practical example of this query.
Once again appreciating you for your reply.
Lakshmanan Sethu SankaranarayanPosted Feb 25, 2014, 12:48 AM