how to set LoadContentFrom kendo window in run tim

2019-02-21 03:01发布

i'm starter in kendo ui, i want use kendoUi window but i have some problem for use i write this code for create window

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

in page i have some button , i want when user click in one of this button set LoadContentFrom dynamically with jquery. But I do not know how to do it. please help me. thanks all.

3条回答
太酷不给撩
2楼-- · 2019-02-21 03:38

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

查看更多
神经病院院长
3楼-- · 2019-02-21 03:47

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)
查看更多
Luminary・发光体
4楼-- · 2019-02-21 03:50

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();
    }
查看更多
登录 后发表回答