Search

ASP.NET: Maintain Scroll Position After Postbacks

0 views

To maintain the scroll position after postbacks is important for larger web pages in order to let the user know exactly what is going on. It is good usability and something you would expect in modern web applications. In ASP.NET 1.x you were able to do it simply by setting the MaintainScrollPositionOnPostBack property, which does exactly what the name applies. It has a much smaller impact on the output and it is cross-browser compliant. There are three ways of applying the property to a web page. You can set it programmatically Page.MaintainScrollPositionOnPostBack = true; In the page declaration <%@ Page MaintainScrollPositionOnPostback="true" %> Or in the web.configs <system.web> section. <pages maintainScrollPositionOnPostBack="true" /> This feature is an absolute must-have on large web pages built for postback scenarios. The beauty of it is the simplicity and the low impact.

Found an error or have a suggestion? Let us know and we'll review it.

Share this article

Comments (0)

Please sign in to leave a comment.

No comments yet. Be the first to comment!