Asp.net c# save scroll position when postback

this is the mana:
Page.MaintainScrollPositionOnPostBack Property

Msdn say  “gets or sets a value indicating whether to return the user to the same position in the client browser after postback. This property replaces the obsolete SmartNavigation property.When Web pages are posted back to the server, the user is returned to the top of the page. On long Web pages, this means that the user has to scroll the page back to the last position on the page.When the MaintainScrollPositionOnPostback() property is set to true, the user is instead returned to the last position on the page.”

Usage:
<asp:Page MaintainScrollPositionOnPostBack=”True|False” />

Or  you can add your web config like this for all pages
<system.web>
<pages validateRequest=”true”  maintainScrollPositionOnPostBack=”true”>
</system.web>

Important Note: There is also a problem with this . Does not work with other browsers except ie.

Source:
Happy codding !!
Advertisement