?
Solved

ASP.NET AJAX Maintain page vertical scroll position after redirect

Posted on 2012-03-11
2
Medium Priority
?
872 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 22

Accepted Solution

by:
Mrunal earned 2000 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Suggested Courses

752 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