GeekArticles
Database
SQL ServerResetting Scroll Position When Using
Author: aspnet.4guysfromrolla.com |
Published: 14th Nov 2007 |
Visited: 134 times |
Add CommentFiled in: SQL Server
ASP.NET 2.0 added a number of built-in client-side enhancements that were missing from earlier versions. Many of these
new features were detailed in an earlier article here on 4Guys, Client-Side
Enhancements in ASP.NET 2.0. One of the least undocumented yet most helpful client-side enhancement, in my opinion, is
MaintainScrollPositionOnPostback.
As its name implies, MaintainScrollPositionOnPostback
ensures that the browser's scroll position is maintained
across postbacks. Without MaintainScrollPositionOnPostback, when a user visits a web page that is "taller" than
the browser window, they have to scroll down to see the content further down on the page. If the user then clicks on a Button
or performs some other action that causes a postback, the browser reloads the page and, by default, returns to the home
scroll position at the top of the page, requiring the user to scroll back down to the location they were viewing when the
postback occurred. To have the user's scroll position remembered across postbacks, simply set
MaintainScrollPositionOnPostback to True, which can be done on a page-by-page basis or applied to all pages
by configuring this option through Web.config.
While MaintainScrollPositionOnPostback makes it easy to keep the visitor at the same scroll position across
postbacks, there are scenarios where you may not want to return the user to their scroll position on postback, but
instead return them to the top of the page. One such example is when displaying a pageable grid. When the user edits a
record, you would want to keep them at the same scroll position, but when they change the page or delete a record, you
may want to reset their scroll position to the top on postback. In this article we will examine a way to override the
behavior of MaintainScrollPositionOnPostback on a case-by-case basis. Read on to learn more!
Read More >
Read Article Sponsored Links
Related Articles
• Scroll Window A scroll window that surpasses the 16-bit limit and can be hosted by a dia ...