Reputation: 25
I'm making a project where my login form goes to another function in the controller with a different name. I want to send error message in the current view from that function. How can I do it? Thank you
Upvotes: 1
Views: 571
Reputation: 1178
You can use TempData["Keyword"] for this. If the controller follows another httpRequest then also it holds the data until it is read.
Controller
TempData["Error"]="This is error";
View from Other Controller
<lable>@TempData["Error"]</lable>
Fro better understanding
Upvotes: 1