Maintain scroll position on postback in modal popup
A. Add 2 functions to store and set scroll position
1. storeScrollPositionEd(scrollValue) = save scroll position while scrolling
2. setScrollPositionEd() = set top position of div
<script type="text/javascript">
function storeScrollPositionEd(scrollValue) {
$('#<%=hfEdScrollPosition.ClientID%>').val(scrollValue);
}
function setScrollPositionEd() {
$("#divEdScroll").scrollTop($('#<%=hfEdScrollPosition.ClientID%>').val());
}
</script>
B. Find the modal-body DIV name an Id and add onscroll function
C. Add a HiddenField to store scroll value
<asp:HiddenField ID="hfEdScrollPosition" runat="server" Value="0" />
D. call setScrollPositionEd() function after a postback
Comments
Post a Comment