Opening RadWindow Causes Page To Scroll To Top

5 posts, 1 answers
  1. Brixel
    Brixel avatar
    8 posts
    Member since:
    May 2013

    Posted 07 May 2013 Link to this post

    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.
  2. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 08 May 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Brixel
    Brixel avatar
    8 posts
    Member since:
    May 2013

    Posted 08 May 2013 Link to this post

    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?
  5. Brixel
    Brixel avatar
    8 posts
    Member since:
    May 2013

    Posted 08 May 2013 Link to this post

    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.
  6. Suresh
    Suresh avatar
    9 posts
    Member since:
    May 2015

    Posted 25 Jun 2015 in reply to Brixel Link to this post

    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);
    }

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017