【问题标题】:Kendo UI Notifications and MVCKendo UI 通知和 MVC
【发布时间】:2015-01-12 10:03:05
【问题描述】:

有没有人从 MVC 服务器端尝试过Kendo UI notifications,比如MvcFlashMessages

我想在表单提交后显示“成功或错误”通知(在我的场景中,表单提交后控制器操作重定向到查看项目列表,我想显示成功通知)。

或者可能有更多不同的场景,例如在网格项目创建/删除/编辑通知显示之后,但如果某些错误不仅来自 JS,则通知必须从服务器端上升。

感谢关注。

【问题讨论】:

    标签: asp.net-mvc asp.net-mvc-4 kendo-ui kendo-ui-mvc


    【解决方案1】:

    首先你可以查看这个网站。 http://demos.telerik.com/kendo-ui/notification/templates

    我给你举了一个例子。

        $(document).ready(function () {    
    
        var addUserUrl = "<%=Url.Action("AddUser", "ControlAccount")%>";
    
        $("#addUser").click(function addUserFunc() {
    
            var userName= 'exampleUser';
            var password = 'examplePassword';   
    
    
            $.post(addUserUrl, { userName: userName, password: password}, function (data, result) {
    
                var d = new Date();
                staticNotification.show(kendo.toString(d, 'HH:MM:ss.') + kendo.toString(d.getMilliseconds(), "000"), text);
                var container = $(staticNotification.options.appendTo);
                container.scrollTop(container[0].scrollHeight);
    
            });
        });
    

    在服务器端;

        [HttpPost]
        public ActionResult AddUser(string kullaniciAdi, string password)
        {
            var result = "";            
          //// Do it your jobs
            return Json(result, JsonRequestBehavior.AllowGet);
        }   
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-10-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多