dcsimg
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: ASP.NET
Expertise: Intermediate
Sep 11, 2009

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


Preserve Browser Scroll Position After a Postback

For large web pages, you often want to maintain the user's current scroll position after a postback. To do that, use one of the following methods:

  • In Web.config, in the <pages> section, add the Boolean attribute maintainScrollPositionOnPostBack="true". This will maintain the scroll positions for all the web site pages.
  • In the page declaration, add <%@ Page MaintainScrollPositionOnPostback="true" %>. Doing so maintains the scroll position for that page only.
  • From code behind, you can include System.Web.UI.Page.MaintainScrollPositionOnPostBack = true;. That's the equivalent of using the page declaration (it maintains the scroll position for only the altered page).
Nagaraj Divella
 
Thanks for your registration, follow us on our social networks to keep up-to-date