Sunday, 17 January 2010

Maintaining user scroll position on postback

When your user is scrolled down on a 'tall' page and does something that evokes a postback, like submitting some form data, we often want to return to their scroll position after postback. This is a particularly common requirement when reporting validation failures to the user on a form submitted when we're using server-side validation rather than javascript.

ASP.net makes this incredibly easy for us. It's as simple as adding this to your page directive:
MaintainScrollPositionOnPostback="true"
Don't you just love it?

No comments:

Post a Comment

Comments are moderated, so you'll have to wait a little bit before they appear!