I have a asp Panel that opens as a Modal Popup window using ajax. Within this panel are some user controls that can postback, for example a gridview that allows custom editing and adding.
However due to the size of the Panel I have had to introduce scrollbars so that the user can scroll the asp Panel and edit the corresponding gridview. On postback though the scroll bar within the Panel is repeatedly placed at the top, and not maintaining scroll position.
My question is; is there a way to maintain scroll position within thisModal Popup Extender Panel?
The code that was used (for reference) is:
var iST;
$(document).ready(function() {
getScrollPosition();
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(getScrollPosition);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(setScrollPosition);
});
function pageLoad() {
var popup = $find('<%=MODALPOPUPNAME.ClientID%>');
popup.add_shown(setScrollPosition);
}
function getScrollPosition() {
iST = $("#<%=PANELNAME.ClientID %>").scrollTop();
}
function setScrollPosition() {
$("#<%=PANELNAME.ClientID %>").scrollTop(iST + 20);
}
Thanks.