Preventing browser scroll back to top on window open and move

7 posts, 0 answers
  1. Karl Wilkens
    Karl Wilkens avatar
    206 posts
    Member since:
    Oct 2012

    Posted 23 Oct 2009 Link to this post

    Hi,

    We have a very tall form with a href links throughout. If a  user scrolls down, and clicks a link, this opens a radwindow. We are getting the current x and y pos of the mouse so that we set the radwindow position to something relative to where the mouse is - the goal being to just have the window appear wherever you are at in the position of the screen. However, when the radwindow opens, the browser resets the scroll position so we are looking at the top of the page - with our radwindow way down and invisible.

    How can we open a rad window, and set its position but not have the browser scroll back to the top (we are using Firefox 3.5.3 in tests) ? Here is our code. Thanks in advance!

     function openRadWindow(ESID) {
                var oWnd = radopen("ViewFaculty.aspx?ESID=" + ESID, null);
                oWnd.SetSize(600, 550);
               // tempX and tempY are the current mouse x and y positions
                oWnd.moveTo(tempX, tempY);
                return false;


            }
  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 26 Oct 2009 Link to this post

    Hello Karl,

    How exactly do you open that RadWindow? For example if you are using <a href="#" onclick="codetoopen()", this will always result in page scrolling up as the browser treats this link as an anchor. Please provide a sample code that would allow us to reproduce the problem locally.


    Kind regards,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Karl Wilkens
    Karl Wilkens avatar
    206 posts
    Member since:
    Oct 2012

    Posted 26 Oct 2009 Link to this post

    Hi, we were doing it just like you suspected

                            ret = ret & "<a href=" & Chr(34) & "#" & Chr(34) & " javascript:openRadWindow(" & dr("EventSpeakerID") & ");>" & fn & "</a>

    So how do we create a link that when clicked, opens a radwindow without that behavior? Thanks.

  5. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 27 Oct 2009 Link to this post

    Hello Karl,

    Try <a href="javascript:void(0)" onclick="openFn()".



    Greetings,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Mike
    Mike avatar
    1 posts
    Member since:
    Apr 2008

    Posted 22 Nov 2010 Link to this post

    Most useful 18 characters I have read all day.  Tks very much folks.
  7. LeBear
    LeBear avatar
    233 posts
    Member since:
    May 2006

    Posted 18 Feb 2011 Link to this post

    I'm doing this with a DockCommand.  The DockCommand has an OnClientCommand that calls my JavaScript, which opens the RadWindow.  I'm getting a scroll to top thing going on, too.  How can I avoid this?
  8. LeBear
    LeBear avatar
    233 posts
    Member since:
    May 2006

    Posted 18 Feb 2011 Link to this post

    Ah, solved!  In another thread, I found that setting focus was the problem.  The focus fired before the page was completely loaded.  I'll fix this by registering a startup script.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017