Tag: scroll position


Let Asp.net to Maintain Scroll Position

December 4th, 2008 — 10:21am

Before i learn MaintainScrollPositionOnPostBack property. I was creating a zero widthed, zero heighted and zero bordered textbox. Then call Focus() for that textbox to behave like page remembers the position :)

sounds funny but it works!

from today on i am using MaintainScrollPositionOnPostBack . to let asp.net to remember the scroll position.

/// <summary>
/// Use this class for base of all pages
/// </summary>
public class BasePage:Page
{
    public BasePage()
    {    }
 
    protected override void OnInit(EventArgs e)
    {
           base.OnInit(e);
           MaintainScrollPositionOnPostBack = true;
    }    
}
  • Facebook
  • Twitter
  • StumbleUpon
  • del.icio.us
  • Digg

Comment » | Asp.Net

Back to top