how to set LoadContentFrom kendo window in run time

馋奶兔 提交于 2019-12-01 14:24:51

you can try this

   $("#youbuttonID").bind("click", function() {
       $("#Details").data("kendoWindow").open();
   });

to load conent from use

@(Html.Kendo().Window().Name("Details")
    .Title("Customer Details")
    .Visible(false)
    .Modal(true)
    .Draggable(true)
    .LoadContentFrom("brand", "edit") 
    .Width(300)

You need to get hold of the window object, set its url and pass in the query string to the url property. This works for me:

        var window = $("#Details").data("kendoWindow");
        window.refresh({
            url: '/YourController/YourAction/......',

        });
        window.open().center();

Additionally, you can pass in some data to the action as well:

        window.refresh({
            url: '/YourController/YourAction/......',
            data: { id: 10, enterpriseId: 88}

        });

Or you copuld just have a function to create the window on the fly and set it's content url with some parameter:

    function createKendoWindow(contentUrl) {
        $(document.body).append('<div id="Window"></div>');
        $('#Window').kendoWindow({
            title: "Log In",
            modal: true,
            resizable: false,
            width: 400,
            content: contentUrl,
            visible: false,
            minHeight: 350,
            animation: {
                open: {
                    effects: "expandVertical",
                    duration: 1000
                },
            },
            close: function () {
                setTimeout(function () {
                    $('#Window').kendoWindow('destroy');
                }, 200);
            }
        }).html('<img src="761.gif" />').data('kendoWindow').center().open();
    }

You can use LoadContentFrom and specify Action and Controller. The action will have its own View attached to it. See here for details.

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