I used the following piece of code in the web.config in order to maintain the scrollbar position after a server postback:
<pages maintainScrollPositionOnPostBack="true" >
</pages>
All is working fine, but now i have a gridview encapsuled within a div with a scrollbar in the div (internal scrollbar).
When an event occur on one of the rows inside the gridview, the internal scrollbar doesn't maintain its original position unlike the outer one.
Any ideas?
I dont have a long long explanation and any explanation, the most important part is these codes work on my project.
this is from http://www.codeproject.com/Articles/30235/Maintain-GridView-Scroll-Position-and-Header-Insid
For future reference:
The normal procedure is to write the following in the web.config file:
This will preserve the scroll bar position of all web pages.
If you have a scroll bar within a gridview (or div) then use the following script:
And the div must be as follows:
http://michaelsync.net/2006/06/30/maintain-scroll-position-of-div-using-javascript-aspnet-20
You can do what you want, but it will need to be done client-side with something like jQuery. The following tutorial uses jQuery to determine the value of the scrollbar within your GridView control and then restore that value every time the
$(document).ready
function is called. In this manner your scroll bar will be reset to it's position before the postback as you wish.Easily maintaining scroll position in GridView using jQuery
Try this,
In the Page_Load