This is a migrated thread and some comments may be shown as answers.

AutoSize Behavior Question

4 Answers 89 Views
Window
This is a migrated thread and some comments may be shown as answers.
J. E.
Top achievements
Rank 1
J. E. asked on 08 Feb 2012, 10:55 PM
Hi all,

I have a RadWindow control that has its NavigateURL set to an aspx page in my application. The window is displayed as a result of the user selecting an item from the RadToolBar. I have the window loading correctly, but it seems like the first time the window loads, it uses some predefined dimensions and then snaps to the size of the content. This looks really ugly. If I close the window and open it again, it loads fine until the parent page is reloaded and then it starts all over again.

Is there any way to get the content to load before the window is shown so that it has time to figure out the required dimensions? I have tried calling the autoSize method from the ClientOnPageLoad, but that didn't work.

Any recommendations?

Thanks,
Jen

4 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 10 Feb 2012, 10:46 AM
Hi Jen,

This is the way autosizing should behave to allow better performance and faster reaction. Also, before the entire page is loaded in the RadWindow there is no way autosizing can be invoked properly as the page does not have its final dimensions. The initial size you refer to is either the Width and Height properties set in the markup, or the default 300 by 300 pixels the RadWindow has.

What you can do to work around this behavior: when you initially open the RadWindow you can use only the setUrl() method to make it load the page you want. Then in the OnClientPageLoad event that is fired when this content page loads you can show it, as autosizing has taken effect. Note, however, that this will request the content page each time the RadWindow is reopened, while its default behavior is to cache the page when it is closed. It will also delay its showing, especially in a real scenario where network delay is an actual issue.

I am attaching a simple example of this behavior and you can see how it works with me here: http://screencast.com/t/PPKEzKv5N1P. I hope this fits your needs.


Regards,
Marin
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
J. E.
Top achievements
Rank 1
answered on 10 Feb 2012, 04:48 PM
Hi Marin,

Thank you for the response and the sample code. It worked perfectly.

Thanks,
Jen
0
J. E.
Top achievements
Rank 1
answered on 10 Feb 2012, 05:49 PM
Hi Marin,

I had a quick followup question. If I change the animation to something like FlyIn, I see the behavior again of the window coming up with the default size and then snapping to the content size.

For my code, I think I can get away without the animation, but I am curious about why this is happening?

Thanks,
Jen
0
Marin Bratanov
Telerik team
answered on 13 Feb 2012, 01:05 PM
Hi Jen,

 Animations are a very tricky aspect of showing a popup and when they are involved some size calculations and display changes must happen in a different order. This is so because animation is ultimately changing dimensions and visibility. My workaround would work well when the standard behavior is executed, but it cannot be modified to work with animations, because at the point we need to animate we still cannot have the final dimensions. Generally the AutoSize functionality is designed to "snap" visibly, which was the initial behavior we wanted to avoid, so when we override some of the defauilt behavior we could not expect that everything can work like before.


Kind regards,
Marin
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Window
Asked by
J. E.
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
J. E.
Top achievements
Rank 1
Share this question
or