Kendo UI Notifications and MVC

荒凉一梦 提交于 2019-12-11 18:41:43

问题


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).

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.

Thanks for attention.


回答1:


First of all you can check this website. http://demos.telerik.com/kendo-ui/notification/templates

I gave you an example about it.

    $(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);

        });
    });

In the server side ;

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


来源:https://stackoverflow.com/questions/27899393/kendo-ui-notifications-and-mvc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!