c# – asp.net mvc3应用程序的状态通知系统

前端之家收集整理的这篇文章主要介绍了c# – asp.net mvc3应用程序的状态通知系统前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我只是想知道如何实现asp.net mvc3应用程序的通知系统,基本上当用户登录系统成功登录页面显示消息,如果不是错误消息.

我有一些方法与上述问题保留属性值在viewmodel,但不知道如何实现,当我们将通知从一个控制器传递到另一个控制器或从一个动作到另一个动作.

像我们登录到系统登录成功的消息从帐户控制器到家庭控制器,并显示主页上的通知消息用户登录成功.

请问,如果您能提供代码示例或上述问题的最佳方法,我真的很方便.

Thnaks

P.S

这是我正在尝试的一些代码片段

public ActionResult Register(UserRegistrationviewmodel registrationModel)
 {
   //some logic and when end of the code set the error message and
   //redirect to separate action and after new action can read the message and show
      if(success)  
         return RedirectToAction("Index","Home"); 
      else
         return RedirectToAction("logon");
 }

解决方法

我喜欢使用purr jQuery插件

http://code.google.com/p/jquery-purr/

如果我想显示状态消息,我将其添加到TempData.在我的页面底部,我有一个帮助程序,如果它找到一个TempData [“StatusMessage”]它调用purr显示它.

原文链接:https://www.f2er.com/csharp/91580.html

猜你在找的C#相关文章