Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC3 Razor - Maintain scroll position on postback

How can i maintain scroll position on postback after sorting a grid table that uses MvcContrib framework?

like image 673
Mast3r Avatar asked Sep 02 '11 01:09

Mast3r


1 Answers

The usual way is to use some javascript to set the current scroll position to a hidden field, then restore that position on page load (usually in a jquery ready event).

However, that's really just a side effect. You should be doing some kind of ajax command to update the grid rather than a postback, then no scrolling required.

like image 112
Erik Funkenbusch Avatar answered Oct 19 '22 23:10

Erik Funkenbusch