GridView is scrolling back to top after row selection

左心房为你撑大大i 提交于 2019-12-04 23:24:53

If it's happening during a postback, then in your <%@ Page %> directive you can add the following:

MaintainScrollPositionOnPostback="true"

This was added in .NET 2.0, and adds some JavaScript to the page to ensure that the page scrolls back down to the control that caused the postback.

Works a treat.

I've found another solution. If you have GridView inside scrollable div container I recommend this: Maintain Scroll Position of DIV

Is it reloading the whole page after selecting the rows ? If so, try to put the GridView in an UpdatePanel, so that the event is sent to the server without actually reloading the whole page.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!