As we all know, when you place a <div> with overflow set, you can get a scrollbar around a datagrid.
<div style="overflow:auto; height: 150px;">
<asp:datagrid...
...
</div>
Now, the client scrolls down the datagrid, clicks on a link in column 1, it goes to a new page.
She then clicks on the browser back button.
When the browser goes back to the page with the datagrid, the scrollbar is back at the top of the datagrid. She finds this disturbing. :rolleyes:
The question is: Is there a way to maintain this scroll position?Try substituting the standard overflowing divs with a .Net component that will keep track of scrolling positions over postbacks - this might also work for your case as well although I haven't tried it specifically.
The one I use is available at http://metabuilders.com/Tools/ScrollingPanel.aspx
HTH
DJ
Thanks for the reply. I just played around with this, but doesn't work for browser back/forwards.
I then came across something interested and a little ironic.
http://authors.aspalliance.com/JimRoss/Articles/MaintainScrollPos.aspx
If you view the demo (http://authors.aspalliance.com/JimRoss/Samples/MaintainScrollDemo.aspx), the first grid isn't supposed to maintain scroll position, and the second is.
That is true for postbacks.
But if you click the link that says "Old Dog, New Tricks" and then click the browser's back button, the first grid's scroll position is maintained. Tell me if you notice this behavior too!
Yes it does the same thing for me in both IE and Firefox. By the way that scrolling control doesn't work in Firefox.
In which case why does your scrolling div not hold the position when you click back? Weird. Have you tried it in various browsers?
DJ
Probably because the concept of hidden fields being used in this way here doesn't suit well with FF?
I am only trying this for IE, that's the only required browser.
The only other way I can think of right now is to have a timer 'record' the scroll position every 200 ms so that when the browser back button is pressed, it remembers it. Just a theory. I don't plan on trying it. I now plan to tell them it will not be done. :)
Thanks for your time.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment