I am new to ASP.NET MVC 4.
I am trying to Toggle a div or p tag on the basis of a condition. I got the answer to display the tags using tempdata like so,in the Index Action Method of Home Controller
@if (TempData["notice"] != null) {
<p id="para">@TempData["notice"]</p>
I am setting the Tempdata in another Action Method of another controller
TempData["notice"] = "Successfully registered";
return RedirectToAction("Index", "Home");
Once the control is sent back tothe index method,the paragraph is displayed correctly. I was wondering ,if there was a way to hide it now.
I know,we can use
document.getElementById('para').style.display = "none";
If I use this,I wont be able to see the para even after redirect. Kindly guide me in the right direction.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.