Solved

ASP.NET AJAX Maintain page vertical scroll position after redirect

Posted on 2012-03-11
2
836 Views
Last Modified: 2012-03-12
I have a search page on my site.  The user selects search criteria from cascading drop-downs, then clicks the search button and the results are displayed in a gridview on the same page.  All of this occurs inside an AJAX update panel.  When a user clicks an item in the results grid, they are redirected to a details view page.

I am using the AJAX script manager history function for storing the search info and grid page index, and this is working great- when the user clicks the browser's 'back' button, the page returns to the correct drop-down selections, results, and grid page index.

The one thing it does not do is retain the vertical scroll position of the page, so that when the user clicks the 'back' button to return to the search page, it returns to the vertical position they left it at.

This is where I need help- how can I grab the search page's vertical scroll position when the user is redirected to the details page, and restore it when the user clicks the 'back' button from the details page?
0
Comment
Question by:cmerlo1
2 Comments
 
LVL 22

Accepted Solution

by:
Mrunal earned 500 total points
ID: 37709116
There is really no direct mechanism available for this.
So you have to do something extra.
Like, you can do this by storing scroll value into cookies and set again that page's scroll position to that one.

This you can achieve by JavaScript:

1. http://stackoverflow.com/questions/1086825/back-button-scroll-position

2. http://wiki.asp.net/page.aspx/1667/maintain-panel-scroll-position-in-ajax-update-panel/
0
 

Author Closing Comment

by:cmerlo1
ID: 37712513
That did the trick!  I knew I needed Javascript- just didn't know the best way to implement it.  The cookies work perfectly.  Many thanks!
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question