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

Preventing browser scroll back to top on window open and move

11 Answers 442 Views
Window
This is a migrated thread and some comments may be shown as answers.
Karl Wilkens
Top achievements
Rank 1
Karl Wilkens asked on 23 Oct 2009, 08:00 PM
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;


        }

11 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 26 Oct 2009, 12:15 PM
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.
0
Karl Wilkens
Top achievements
Rank 1
answered on 26 Oct 2009, 01:25 PM
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.

0
Georgi Tunev
Telerik team
answered on 27 Oct 2009, 11:36 AM
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.
0
Mike
Top achievements
Rank 1
answered on 23 Nov 2010, 01:27 AM
Most useful 18 characters I have read all day.  Tks very much folks.
0
LeBear
Top achievements
Rank 1
answered on 18 Feb 2011, 02:44 PM
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?
0
LeBear
Top achievements
Rank 1
answered on 18 Feb 2011, 02:56 PM
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.
0
Shweta
Top achievements
Rank 1
answered on 12 Dec 2018, 02:27 PM

I am getting same issues

I am using hyperlink button in .net.on button click i am calling radopen funtion using J's.

Radwindow is showing down and parent page got scrolled..

 

Suggest me answers

0
Marin Bratanov
Telerik team
answered on 12 Dec 2018, 03:29 PM
Hi Shweta,

Take a look through the following threat that explains the most common reasons and solutions to this: https://www.telerik.com/forums/radwindow-moves-by-itself-after-opening.

If it doesn't help you fix this, open a support ticket and send us an MCVE of the problem so we can take a look.


Regards,
Marin Bratanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Shweta
Top achievements
Rank 1
answered on 13 Dec 2018, 07:07 AM

hii, i have set the property in navigateurl in aspx page.Still getting this issue

<asp:HyperLink runat="server" ID="hlnkNoteAdd" Text="Add Note" NavigateUrl="javascript:void(0);" ></asp:HyperLink>

<telerik:RadWindow ID="NoteWindow" runat="server" Modal="True" Height="500px" Width="700px"  
VisibleStatusbar="false" ReloadOnShow="true" ShowContentDuringLoad="false" CenterIfModal="true">
</telerik:RadWindow>

and from code behind using this .In URL i am setting dynamic id

hlnkNoteAdd.Attributes.Add("onclick", "ShowRadWindow('" + Url + "','NoteWin');");

Please suggest me

 

 

0
Shweta
Top achievements
Rank 1
answered on 13 Dec 2018, 01:49 PM

I have used keepibscreenbou ds property.now it's showing it in screen boudary but still getting display in different different place, i want to display it in centre...my first problem is solved as i remove textbox.focus from code behind.now parent screen is not scrolled.

 

0
Marin Bratanov
Telerik team
answered on 14 Dec 2018, 02:46 PM
Hi Shweta,

The following article explains the most common problems and solutions from wrong positioning of our controls: https://www.telerik.com/support/kb/aspnet-ajax/details/incorrect-positioning-of-controls.


Regards,
Marin Bratanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Window
Asked by
Karl Wilkens
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Karl Wilkens
Top achievements
Rank 1
Mike
Top achievements
Rank 1
LeBear
Top achievements
Rank 1
Shweta
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or