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

Firefox scroll issue

8 Answers 135 Views
Window
This is a migrated thread and some comments may be shown as answers.
Dennis
Top achievements
Rank 1
Dennis asked on 02 Dec 2008, 09:06 PM
We are using version 2008.3.1105.35.  I have a page that uses a asp:gridview which contains a link to open a rad window.  The grid is long and requires vertically scrolling.  The rad window used to open at the top of the page and have the background disabled.  Now the window opens at the scrolled position and causes firefox to scroll up so you can only see the top of the modal window.  This seems to only happen in firefox.  Any ideas?

Thanks

8 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 04 Dec 2008, 01:44 PM
Hello Dennis,

At this point I cannot tell what the reason for the problem might be as I cannot reproduce it locally. Could you please open a support ticket and send me a small sample project where this behavior could be reproduced? I will check it right away.



All the best,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Dennis
Top achievements
Rank 1
answered on 04 Dec 2008, 09:25 PM
I went to make a sample and I cannot reproduce it.  The current project that has it in it is quite large and uses many css position attributes.  Is it possible that my css floats and position attributes have affected the rad window?
0
Dennis
Top achievements
Rank 1
answered on 04 Dec 2008, 09:42 PM
I also noticed, when the radwindow initially pops up, for a split second, the form elements contain data from the last time the radwindow was shown.  Then when it repopulates the elements in the pages page_load event (of the radwindow) is when the window scrolls that you can no longer see the entire rad window.
0
Dennis
Top achievements
Rank 1
answered on 04 Dec 2008, 09:49 PM
I found the issue, I don't think its related to RadWindow at all, but I'll post it anyway.  On my radwindow page, I have a server side controlName.focus() - this apparently causes the browser to scroll to the spot where the focused control is near the bottom of the page.  This must be some sort of a firefox bug.  Any thoughts?
0
Dennis
Top achievements
Rank 1
answered on 04 Dec 2008, 10:22 PM
It appears that using the server controls .focus method gets executed before the page is fully rendered in firefox (firefox tries to adjust the screen based on what has focus I think).  I ended up setting the focus using a Me.Page.ClientScript.RegisterStartupScript which solved the problem.

Thanks!
0
Tervel
Telerik team
answered on 05 Dec 2008, 08:27 AM
Hello Dennis,

We are glad you got the issue resolved. Indeed, for some reason unknown the MS implementation of the <serverControl>.Focus() method comes down to injecting a simple client-side script on the page that will indeed set focus to the element. So far, so good. There is a serious shortcoming however when a developer is using MS AJAX based controls - the "focus" script executes right away where it is injected - and that is before the page has even fully loaded, and before the window.onload event that causes MS AJAX page initialization is triggered.

Thus, as a result such problems occur. If the "focus" script was properly inserted to execute after the page has loaded, all would be fine. We are not sure why the Focus methon in the ASP.NET framework is implemented in such a manner, but the only reasonable workaround is the one you found - to use RegisterStartupScript  to set focus.


Best regards,
Tervel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Scott Davis
Top achievements
Rank 1
answered on 26 Oct 2011, 03:05 AM
This is a really old thread, but it does seem to apply to an issue I am currently having.

I have a scenario where I am using a RadGrid to display a long list of items, enough so that the user would have to scroll down to see some of the items.  On each item, the user can click a link which opens a RadWindow for editing the item.  All of this works fine.

However, like the original poster for this thread, if the page that is being opened in the RadWindow calls a control.focus() method it causes the page to scroll all the way back to the top.  The RadWindow is opened at the location where the item in the grid was clicked, so depending on how far you scrolled down before you clicked to open an item you might not even be able to see the RadWindow at all without scrolling down again.

I have tried eliminating the control.focus() call and have replaced it with a RegisterStartupScript call as prescribed here.  However, that causes the exact same behavior.  Here is the RegisterStartupScript call

this.Page.ClientScript.RegisterStartupScript(this.GetType(), "setFcs", string.Format("document.forms[0]['{0}'].focus();", txtLastName.ClientID), true);


Any ideas?  I am testing this in Internet Explorer 9.
0
Marin Bratanov
Telerik team
answered on 27 Oct 2011, 04:18 PM
Hello Scott,

We have seen similar behavior when focus() is called and usually adding a small timeout resolves the situation, for example try:
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "setFcs", string.Format("setTimeout(function(){document.forms[0]['{0}'].focus();},0);", txtLastName.ClientID), true);

I hope this will help. Usually such a timeout is needed to allow the browser to finish a previous operation that is needed for the current one, so it may also help here.

Regards,
Marin
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
Tags
Window
Asked by
Dennis
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Dennis
Top achievements
Rank 1
Tervel
Telerik team
Scott Davis
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or