If you’ve ever spent hours writing a page only to have it jump all over the place during any postback, this tip will make your day.  With one simple command in Page_Load() you can make the page stay exactly where it was before the postback fired.

In your Page_Load() routine, add this line:

this.Page.MaintainScrollPositionOnPostBack = true;


Now some will say "I can already do that in the .ASPX file."  That’s swell, but in AbleCommerce-Land you rarely work with the original .ASPX file.  In AbleCommerce-Land the vast majority of your work will be inside User Controls, so you don’t have direct access to the page declaration.

Using this technique works great in a user control and you don’t have to worry about modifications to a .ASPX file conflicting with other controls that use the same .ASPX file.

Nifty!  Winking smile