0

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.

4

1 回答 1

0

首先你可以看看这个网站。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);
    }   
于 2017-03-30T07:23:45.990 回答