aspx Tutorial

NET Articles,jQuery demo, asp.net with jQuery, online tutorial,Jquery, SilverLight, Javascript, asp.net,JSON, MVC,.NET Articles,demo, Web Services,
Advertise Here

Toolbar

Get our toolbar!

Advertize



Posted by Aamir Hasan   on Tuesday, June 28, 2011 Total Views:  

In this example, you will learn how to maintain scroll position in asp.net page after Postback is fired.

When Postback is fired, user returns on the top position of current page. User has to scroll down manually on last location of the page where he was working.

Page.MaintainScrollPositionOnPostBack Property is used to set or get the position of page after Postback is fired. Page.MaintainScrollPositionOnPostBack is supported in 2.O, 3.O, 3.5 and 4.O

Here’s an example

You can add below line on Page directive for a single page to maintain the previous scroll position when post back is fired.

<%@ Page MaintainScrollPositionOnPostback="true" %>

 

You can add below script on code behind for a single page to maintain the previous scroll position after post back is fired

Page.MaintainScrollPositionOnPostBack = true;

 

You can add below settings on Web.Config for all pages to maintain the previous scroll position when Postback is fired.

<configuration>

       <system.web>

              <pages maintainScrollPositionOnPostBack="true" />

       </system.web>

</configuration>

 

 

Note:

  1. Page.MaintainScrollPositionOnPostBack will not work in ASP.NET 1.O and 1.1.
  2. Page.SmartNavigation property will work in ASP.NET 1.O and 1.1
  3. Page.SmartNavigation property is Obsolete in Frame work 2.O and higher
Protected by Copyscape Online Plagiarism Tool

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5