How to Maintain scroll position on postback in asp.net

Page.MaintainScrollPositionOnPostBack Property is used to get or set the position of page after Postback is fired.

Page.MaintainScrollPositionOnPostBack is supported in frameworks greater than equal to 2.0

You can add the following line on Page directive for a single page to maintain the previous scroll position on post back.
<%@ MaintainScrollPositionOnPostback="true" %>
Or you can add following line to the c# code behind of your asp.net page
Page.MaintainScrollPositionOnPostBack =true;
You can add following settings on Web.Config file for all pages of your website to maintain the previous scroll position when Postback is fired.





0 comments:

Post a Comment