How to maintain scrollposition after post back?

By Emanuele Bartolesi at June 09, 2009 06:31
Filed Under: Asp.net, C#

By default When web pages fire a post back to the server, the browser scroll is returned to the top of the page.
When the page is tall, it is very annoying.
You are three ways to kill this behaviour.

   1. Application level: To set the property by default for all pages in the website, open web.config and add the attribute to the pages node.

      <pages maintainScrollPositionOnPostBack="true">

   2. Page Level: for a particular page, open the aspx and set the property

      <%@ Page MaintainScrollPositionOnPostback="true" >

   3. Code level: to set the property programmatically

      Page.MaintainScrollPositionOnPostBack = true;

 

About me

I will also give you some useful tips, based on the modest wisdom gained during the years that I've worked as a developer and project manager.

Widget

Ohloh profile for Emanuele Bartolesi

 

Wakoopa

Software tracking

 

Software tracking

from Amazon



hacker emblem



Scarica il pdf di Game
Rivista Game di videogiochi
Trucchi videogiochi