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

Opening RadWindow Causes Page To Scroll To Top

4 Answers 161 Views
Window
This is a migrated thread and some comments may be shown as answers.
Brixel
Top achievements
Rank 1
Brixel asked on 07 May 2013, 03:23 PM
Hey there,

We are having a problem that, given a typical search, seems rather common with RadWindows. When opening a window towards the bottom of a page that scrolls, it forces the browser back up to the top.  Common causes tend to be the use of anchor tags or setting focus within the RadWindow, but these do not pertain to our situation.

We have implemented a temporary solution of capturing the scroll position and returning the page to that position, but the flicker / flash that occurs is undesirable.

After some additional testing we found that ShowContentDuringLoad seems to have something to do with it. We have this set to false to allow for our forms to load before rendering to the screen. When set to true, the browser stays put and keeps the scroll position as desired.

Has anyone else run into this problem or have any possible solutions? We'd like to keep the ShowContentDuringLoad set to false. Thanks.

4 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 08 May 2013, 11:11 AM
Hi John,

I am not aware of other causes for this behavior than anchors, postbacks and/or setting focus (even default focus) in the RadWindow OR in the main form. Does this happen if you load a different page (e.g. an empty one) in the control? If not then something specific in this pace is causing the browser to attempt to scroll the page. The steps from this blog post can help in determining what it is.

Setting the ShowContentDuringLoad to false moves the iframe that hosts the page outside of the visible viewport of the browser and puts it back in place when it loads. If this changes the scrolling behavior in the browser then the most likely cause for this is that something specific in the page behaves differently in this case.


Greetings,
Marin Bratanov
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 RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Brixel
Top achievements
Rank 1
answered on 08 May 2013, 11:58 AM
Hey Marin,

Thanks for the reply. Taking your advice I removed stuff out of the page to see what could be causing it. By process of elimination it came down to RadButtons. If I have a blank page and just a single RadButton on the page it causes this to happen. There is nothing special about the button either, just plopped it on the page, no custom skins, etc. Any ideas?
0
Brixel
Top achievements
Rank 1
answered on 08 May 2013, 12:31 PM
Hey Marin,

I dug down further and found some code that was setting focus on the button in question, so we can solve the problem now. Thanks.
0
Suresh
Top achievements
Rank 1
answered on 25 Jun 2015, 12:42 PM

Correct.

Just attach OnClientClose="OnRadWinPopupClose" function to RadWindow and set focus to the anchor tag from which you are opening RadWindow..

function OnRadWinPopupClose() {
setTimeout(function() {
document.getElementById("aRadWndLink").focus();
}, 2000000);
}

Tags
Window
Asked by
Brixel
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Brixel
Top achievements
Rank 1
Suresh
Top achievements
Rank 1
Share this question
or