如何在MVC4中保存后显示隐藏的标签 [英] How to show a hidden label after Save in MVC4
本文介绍了如何在MVC4中保存后显示隐藏的标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个用于保存图书详细信息的页面。保存后,我必须显示消息已成功保存,使用隐藏字段。
或使用弹出窗口。
我该怎么办?
请帮忙。
I have a page for saving the book details. After save i have to show a message Saved Successfully, Using the hidden field.
or using a popup window.
How can i do?
Please Help.
推荐答案
你可以设置信息在保存之前,在ActionResult中的ViewData或ViewBag中,如下所示
You can set the message in ViewData or ViewBag in the ActionResult before you are saving like below
public ActionResult Save()
{
//Save Logic here
ViewData["Message"]="Your Record saved successfully";
return View();
}
从视图中您可以获取viewdata值。例如,将ViewData消息放在要显示消息的区域中。
From the view you can take the viewdata value. For example put the ViewData message in the area you want to display the message.
<span>ViewData["Message"]</span>
希望这有助于
Hope this helps
这篇关于如何在MVC4中保存后显示隐藏的标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文