Window Positioning

The window positioning could be adjusted dynamically using the Window JavaScript API.

Positioning and Opening

Usually, it is preferable to center the Window rather than open it near the HTML element used to define its content. Often, the Window is opened as a result of a user action rather than of the load event of the page. The Window JavaScript API provides methods for handling these scenarios. Basically, the widget can be initialized as non-visible and can opened when needed.

The example below demonstrates how to center and open a Kendo UI Window on a button click. If content is loaded through Ajax, centering occurs after request is complete.

Example
@(Html.Kendo().Window()
    .Name("window")
    .Title("Centered Window")
    .Visible(false)
    .Width(200)
    .Height(200)
    .Content(@<text>
            Window content here.
    </text>)
)

@(Html.Kendo().Button()
    .Name("button")
    .Content("Open Window")
    .Events(e => e.Click("onClick"))
)

The example below demonstrates how to center, and open the Window upon button click action.

Example
function onClick(e) {
    var win = $("#window").data("kendoWindow");
    win.center().open();
}

See Also

In this article
Not finding the help you need? Improve this article