If you are using ASP.NET 2.0 you can set theMaintainScollPositionOnPostback="true" in your @.Page declaration.
Thanks for the reply.
But that way, only the main scroll bar in the page is being maintained. I want the same functionality in the two panels in the page as well.
Hi All,
I finally solved this, thanks to the forum members and all the others who helped.
The solution is to store the scroll position of the panels (onscroll event), and then set the scroll postion after the postbacks.
Below is the javascript code I employed, perhaps there is a better method.
//Add this to div - onscroll="getScrollTop(divName,aHiddenFieldName)"//Add this to page load - setScrollTop(divName,aHiddenFieldName)//For more that one panel, have a separate hidden field for each panel and pass the respective values//function to set the div scroll top from the passed hidden filed's valuefunction setScrollTop(divControlId, hiddenControlId){if ( document.getElementById(divControlId) !=null && document.getElementById(hiddenControlId) !=null ){document.getElementById(divControlId).scrollTop = document.getElementById(hiddenControlId).value;}}//function to save the div scroll top from the passed hidden filed's valuefunction getScrollTop(divControlId, hiddenControlId){if ( document.getElementById(divControlId) !=null && document.getElementById(hiddenControlId) !=null ){document.getElementById(hiddenControlId).value = document.getElementById(divControlId).scrollTop;}}Hops this will be of any help to others
0 comments:
Post a Comment