Skip to main content

Posts

Showing posts from February, 2012

Maintain scroll position on postback in ASP.NET

ASP.NET provides lot of cool and handy features and one of them helps us to maintain the scroll position on postback. This is how we implement it : <% @ Page Language ="C#" AutoEventWireup ="true" CodeBehind ="Home.aspx.cs" Inherits ="Ay.LearningApp.Home" MaintainScrollPositionOnPostback ="true" %> This will make sure that scroll position will be maintained at the page. In order to maintain the scroll position for all the pages we can change config file as follows: < configuration >     < system.web >         < compilation debug = " true " targetFramework = " 4.0 " />           < pages maintainScrollPositionOnPostBack = " true " />        </ system.web >    </ configuration > Happy coding!!! Cheers!!!