I have an update panel with content that can sometimes become pretty long and make the user have to scroll. If the user makes a change that causes a post within the update panel and then scrolls the page while the update is in progress it causes the page
to become jumpy.
It looks like the update panel is setting the scroll position back to what the original scroll position was when they first initiated the post. Normally this wouldn't be a problem, but with this page it can take a second or two for the update to finish
some times and it really starts to bug you after a while. Is there any way to turn this behavior of the update panel off or to stop it from happening?
Nope tried that already didn't work. Also tried removing my update progress control. Don't think this issue is more to do with the update panel specifically, because the page isn't actually posting back and refreshing. I'm thinking its a behavior that
they intended to have, because their script must be remembering the scroll position from when the async post was initiated and resetting it when the response comes back, I just need to know if there's a way to turn it off or interupt it somehow.
Does the UpdatePanel have any knowledge about smart navigation? I don't see how that would have any effect on the update panel, because the full page isn't posting back and refreshing.
Yea I saw that article in my searches too, but I think hes dealing with a different problem than me. His stems from having an overflow, scrolling div. My problem is just because the page is longer than the screen height. I put together a simple page to
test my scenerio and make sure it wasn't something else I was doing that was causing the behavior. It basically just has a button in the middle of a bunch of block returns to make the page long. The button sleeps the current thread for 5 seconds to simulate
a long running process. If you run the page below, scroll to the middle, click the button, scroll to the top and then wait 5 seconds, I think you'll see what I mean. I basically just want the scroll position to stay where it currently is after the updatepanel
is done processing. Thanks again for the help.
<%
@ Page
Language="C#" %>
<!DOCTYPE
html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Usually People loves to maintain the scroll postiion. But requirment is reverse, Here is the trick, create an script tag after the scriptmanager and put the following lines:
<script type="text/javascript">
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_beginRequest(beginRequest);
function beginRequest()
{
prm._scrollPosition = null;
}
</script>
jamehol
Member
6 Points
14 Posts
Update Panel Scrolling Issue
Sep 10, 2007 11:07 PM|LINK
I have an update panel with content that can sometimes become pretty long and make the user have to scroll. If the user makes a change that causes a post within the update panel and then scrolls the page while the update is in progress it causes the page to become jumpy.
It looks like the update panel is setting the scroll position back to what the original scroll position was when they first initiated the post. Normally this wouldn't be a problem, but with this page it can take a second or two for the update to finish some times and it really starts to bug you after a while. Is there any way to turn this behavior of the update panel off or to stop it from happening?
Thanks in advance for the help,
James Hollister
Ascending Integration, Inc.
www.AscendingIntegration.com
Update Panel scroll position
chetan.sarod...
All-Star
65739 Points
11138 Posts
Re: Update Panel Scrolling Issue
Sep 11, 2007 03:35 AM|LINK
http://aspnet.4guysfromrolla.com/articles/111704-1.aspx
<pages smartNavigation="true" MaintainScrollPositionOnPostback="true" />
Lety me know if this helpful to you
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
jamehol
Member
6 Points
14 Posts
Re: Update Panel Scrolling Issue
Sep 11, 2007 03:33 PM|LINK
Nope tried that already didn't work. Also tried removing my update progress control. Don't think this issue is more to do with the update panel specifically, because the page isn't actually posting back and refreshing. I'm thinking its a behavior that they intended to have, because their script must be remembering the scroll position from when the async post was initiated and resetting it when the response comes back, I just need to know if there's a way to turn it off or interupt it somehow.
dwhite
Star
8990 Points
1423 Posts
Re: Update Panel Scrolling Issue
Sep 11, 2007 03:36 PM|LINK
Have a look here: http://support.microsoft.com/kb/913721
-Damien
Latest Blog Post: BDD with ASP.NET MVC and Cucumber
jamehol
Member
6 Points
14 Posts
Re: Update Panel Scrolling Issue
Sep 11, 2007 03:51 PM|LINK
Does the UpdatePanel have any knowledge about smart navigation? I don't see how that would have any effect on the update panel, because the full page isn't posting back and refreshing.
dwhite
Star
8990 Points
1423 Posts
Re: Update Panel Scrolling Issue
Sep 11, 2007 05:13 PM|LINK
Perhaps try this: http://www.eggheadcafe.com/tutorials/aspnet/7dd57635-0587-42ba-ae73-f52449e653bf/aspnet-ajax-maintain-scr.aspx
-Damien
Latest Blog Post: BDD with ASP.NET MVC and Cucumber
jamehol
Member
6 Points
14 Posts
Re: Update Panel Scrolling Issue
Sep 11, 2007 08:19 PM|LINK
Yea I saw that article in my searches too, but I think hes dealing with a different problem than me. His stems from having an overflow, scrolling div. My problem is just because the page is longer than the screen height. I put together a simple page to test my scenerio and make sure it wasn't something else I was doing that was causing the behavior. It basically just has a button in the middle of a bunch of block returns to make the page long. The button sleeps the current thread for 5 seconds to simulate a long running process. If you run the page below, scroll to the middle, click the button, scroll to the top and then wait 5 seconds, I think you'll see what I mean. I basically just want the scroll position to stay where it currently is after the updatepanel is done processing. Thanks again for the help.
<%
@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><
script runat="server"> private void btnTesting_Click(object sender, EventArgs e){
System.Threading.Thread.Sleep(5000);}
</script><
html xmlns="http://www.w3.org/1999/xhtml"><
head runat="server"> <title>Untitled Page</title></
head><
body> <form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"> </asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" Runat="server" UpdateMode="Always"> <ContentTemplate>
<div>TEXT Here
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />TEXT 2 Here
<asp:Button ID="btnTesting" runat="server" Text="Test" OnClick="btnTesting_Click" />
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />TEXT 3 Here
</ContentTemplate> </asp:UpdatePanel>
</div> </form></
body></
html>chetan.sarod...
All-Star
65739 Points
11138 Posts
Re: Update Panel Scrolling Issue
Sep 12, 2007 03:27 AM|LINK
Have you solved your problem
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
KaziManzurRa...
Contributor
4802 Points
887 Posts
Re: Update Panel Scrolling Issue
Sep 12, 2007 06:59 AM|LINK
Usually People loves to maintain the scroll postiion. But requirment is reverse, Here is the trick, create an script tag after the scriptmanager and put the following lines:
<script type="text/javascript"> var prm = Sys.WebForms.PageRequestManager.getInstance(); prm.add_beginRequest(beginRequest); function beginRequest() { prm._scrollPosition = null; } </script>Kazi Manzur Rashid
_________________________
Blog: http //kazimanzurrashid.com
Twitter: http://twitter.com/manzurrashid
jamehol
Member
6 Points
14 Posts
Re: Update Panel Scrolling Issue
Sep 12, 2007 03:43 PM|LINK
Awesome, that is exactly what i was looking for. I knew there had to be a way to tell it not to do that. Thanks so much!