Solved

ASP.NET AJAX Maintain page vertical scroll position after redirect

Posted on 2012-03-11
2
857 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 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
javascript delete path 7 44
What are MicroServices? 4 67
Updating checkbox via JQuery does not trigger Knockout binding 6 60
How do I "share" on social sites? 2 38
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 …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
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…

734 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