Kendo UI Window to center after a refresh of large content
asp.net, asp.net-mvc, css, kendo-ui
Solution
The problem seems to be, that you center the window, and than, some time after that, the new content is finished loading.
In other words: The center is called before the window get's its new size through the loaded content.
To prevent this, you should bind to the refresh event of the window, and center in that.
Something along the lines (beware: only register this event once):
var win = $("#myWindow").data("kendoWindow");
win.bind("refresh", function() {
win.center();
win.open();
});
Problem
Using `MVC 4` I add a `blank window` and hide it. On a button click I call this javascript to get content and `center` the window: ``` var win = $("#myWindow").data("kendoWindow"); win.content("Loading..."); win.refresh({ url: "@Url.Action("MyAction", "MyController")", data: { userloginid: "AAA" } }); win.center(); win.open(); ``` The content is `larger than a default window` so the `win.center()` calculation is off, putting the window too far down. How do I get the window to center based on the content it got via the refresh() command.