Kendo UI通知和MVC [英] Kendo UI Notifications and MVC

查看:94
本文介绍了Kendo UI通知和MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人尝试从MVC中 Kendo UI通知服务器端,例如 MvcFlashMessages ?

Does anyone tried Kendo UI notifications from MVC server side, like MvcFlashMessages?

我想在表单提交后显示成功或错误"通知(在我的场景中,表单提交后,控制器动作重定向到带有项目列表的视图,我想显示成功通知).

I want to show "succeed or error" notification after form submit(In my scenario, after form submit Controller action redirects to view with items list and i want to show succeed notification).

或者可能出现更多不同的情况,例如在显示网格项创建/删除/编辑通知之后,但是如果某些错误不仅发生在JS上,则必须从服务器端发出通知.

Or maybe more different scenario like after grid item create/delete/edit notification show but notification must rise from server side if some errors occurs not only from JS.

感谢关注.

推荐答案

首先,您可以检查此网站. http://demos.telerik.com/kendo-ui/notification/templates

First of all you can check this website. 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);
    }   

这篇关于Kendo UI通知和MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆