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?
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?
Share Improve this question edited May 16, 2013 at 8:31 tereško 58.5k25 gold badges100 silver badges150 bronze badges asked May 16, 2013 at 4:29 user1120418user1120418 2713 gold badges8 silver badges18 bronze badges 1- Yep. We can't possibly answer this without your code. – gideon Commented May 16, 2013 at 5:01
1 Answer
Reset to default 8Use
TempData["mesage"]="Hello";
instead of
ViewBag.Message="Hello";
Because ViewBag
maintain data on refresh also but TempData
dispose after render once