This question is locked. New answers and comments are not allowed.
Hey guys
I don't know if it's me or a bug, but I'm not able to center a window which loads content via ajax (contentUrl).
Instead of a "real" center the top left corner of the window gets centered.
I guess it's because the center is being done before the content finished loaded.
A workaround is to center the window inside the success event of the ajax request.
Thanks
I don't know if it's me or a bug, but I'm not able to center a window which loads content via ajax (contentUrl).
Instead of a "real" center the top left corner of the window gets centered.
I guess it's because the center is being done before the content finished loaded.
A workaround is to center the window inside the success event of the ajax request.
Thanks
5 Answers, 1 is accepted
0
Hi roger,
Alex Gyoshev
the Telerik team
Indeed, centering the window before the content loads is not possible because its size is not yet determined. You can either:
- bind an event handler to the refresh event and center the window
- specify the window width / height before centering it
Alex Gyoshev
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Bernt
Top achievements
Rank 1
answered on 18 Nov 2011, 01:45 PM
Hi Alex,
Do you have a sample code on how to implement the refresh event handler?
Best wishes,
Rune
Do you have a sample code on how to implement the refresh event handler?
Best wishes,
Rune
0
Hello Rune,
Please refer to our demos:
http://demos.telerik.com/aspnet-mvc/window/clientsideevents
http://demos.telerik.com/aspnet-mvc/window/clientsideapi
Regards,
Dimo
the Telerik team
Please refer to our demos:
http://demos.telerik.com/aspnet-mvc/window/clientsideevents
http://demos.telerik.com/aspnet-mvc/window/clientsideapi
Regards,
Dimo
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Paul
Top achievements
Rank 1
answered on 16 Dec 2011, 08:41 PM
Below is what I do. The window size is never set. Trigger center code on window events as well as browser events.
.ClientEvents(events => events
.OnLoad(centerWindow")
.OnOpen("centerWindow")
.OnActivate("centerWindow")
.OnRefresh("centerWindow"))
<script type="text/javascript"> function centerWindow() { $("#LoginWindow").data("tWindow").center(); $("#UserName").focus(); } window.onresize = function(event) { centerWindow(); } </script>0
Hi Paul,
Your code works correctly on my side and the open Window is centered according to the browser window. The center() method does not set any widths or heights.
In addition, it is good to make a check whether the Window component exists and is initialized.
Kind regards,
Dimo
the Telerik team
Your code works correctly on my side and the open Window is centered according to the browser window. The center() method does not set any widths or heights.
In addition, it is good to make a check whether the Window component exists and is initialized.
Kind regards,
Dimo
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
