I am having a registration form. After successful registration I have to set ViewBag.Msg in controller and displayed it on view. This time all the fields are clear and only "You have registered successfully" message is there.
Now if I click on Submit then jquery validations are called and error messages like "Required field" are displayed.
But "successful" message is still there. How can I clear this message?
Use
TempData["mesage"]="Hello";
instead of
ViewBag.Message="Hello";
Because ViewBag maintain data on refresh also but TempData dispose after render once
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With