How to maintain scroll position after postback

HelenaG Grulichova asked on March 1, 2012 08:05

How to maintain scroll position after postback

Correct Answer

HelenaG Grulichova answered on March 1, 2012 08:05

In case your application runs on .NET version 4.0 the position should be fixed automatically. A combination of .NET 3.5 and browsers like Chrome or Safari causes the position on a page to be lost after postback.

  1. The workaround is to use the AJAX update panel and check e.g. the Use update panel property in repeater based web parts.
     
  2. If the update panel cannot be used for some reason, you can change the ~/App_Browsers/outputfilter.browser file and add the following code into the <browsers> section:


<browser refID="Safari1Plus">
    <capabilities>
      <capability name="supportsMaintainScrollPositionOnPostback" value="true" />
    </capabilities>
</browser>



Please make sure that your master template, in case of Portal Engine it is file ~/CMSPages/PortalTemplate.aspx, contains the following property set to true:

<%@ Page …  MaintainScrollPositionOnPostback="true" ..%>

-it-
0 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.