Maintaining Scroll Position after Page PostBack in Asp.Net C# VB.Net

Sometimes we need to Maintain scroll position after page postback specially if the page is a large page & user need to work in the middle portion of the page. In this article i will give you a simple tips on How to maintain Scroll Position after Asp.Net Page PostBack. To do that in the Page Directive of your Page, add the property “MaintainScrollPositionOnPostback” and set its value to ‘true’.

The Page Directive will look like:
C# Code:

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="Default.aspx.cs" Inherits="_Default" MaintainScrollPositionOnPostback="true" %>

VB.Net Code:

<%@ Page Title="Home Page" Language="VB" MasterPageFile="~/Site.Master" AutoEventWireup="false"
    CodeFile="Default.aspx.vb" Inherits="_Default" MaintainScrollPositionOnPostback="true"%>

Maintain Scroll Bar Position Csharp VB.Net

Still not clear? Download code example from below:

Download Code Example C#        Download Code Example VB.Net

Posted in .Net,, C#, VB.Net

Leave a Reply

Your email address will not be published. Required fields are marked *