Hi All,
I have a ASP panel and a div within it. the div is defined in a way <div style="overflow-x: hidden; overflow-y: scroll; height: 300px"> to have scroll within the div. I need to maintain the scroll position in the div if any event is occurred. I've tried using MaintainScrollPositionOnPostback = "true" but this fails. and also used the below javascript which also failed to do so
<asp:ScriptManager runat="server" EnablePartialRendering="true" ID="SM1">
</asp:ScriptManager>
<script type="text/javascript">
var xPos, yPos;
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_beginRequest(BeginRequestHandler);
prm.add_endRequest(EndRequestHandler);
function BeginRequestHandler(sender, args) {
xPos = $get('PanelID').scrollLeft;
yPos = $get('PanelID').scrollTop;
}
function EndRequestHandler(sender, args) {
$get('PanelID').scrollLeft = xPos;
$get('PanelID').scrollTop = yPos;
}
</script>
Any alternative to get this?
Appreciate your help..
-Rajesh.