Im working on a project in MVC and have enjoyed learning about it. There are a few growing pains but once you figure them out it’s not bad. One thing that is really simple in the WebForms world is maintaining the scroll position on a page. All you do is set the MaintainScrollPositionOnPostback property to true. However, in MVC, Im not using postbacks so this will not work for me. What is the standard way of handling this?
Edit: Ajax is acceptable, but I was also wondering how you would do it without AJAX.
The way MaintainScrollPositionOnPostback works is that it has a pair of hidden fields: __SCROLLPOSITIONX and __SCROLLPOSITIONY
On a postback, it sets these,
and then it calls RestoreScrollPosition:
But as most people said, MVC should be avoiding postbacks anyway.