Cannot keep track of div position of treeview

vbsouza

New Member
I have implemented a method of keeping track of Div positions - This works fine on my webpage.Now I want to keep track of a div position on a \[code\]modalpopupextender\[/code\] that contains a \[code\]TreeView\[/code\] but its position is restored as 0.I think it may be due to the fact that the popup has not rendered yet as the second message box (\[code\]alert(elem.scrollTop);\[/code\]) below opens before the popup is displayed.The first value being saved is alerted as 860 but is always restored as 0.After the second alert the popup is displayed when I click OK which I believe is the problem as the page is not fully finished.can you tell me please what i need to do to fix?Javascript\[code\]<script type="text/javascript"> <!-- Script to manage scroll position --> $(document).ready(function () { Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler); Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler); function BeginRequestHandler(sender, args) { try { var elem = document.getElementById('AddFiles_Div'); scrollTop = elem.scrollTop; // I am working correctly alert(elem.scrollTop); } catch (err) {} } function EndRequestHandler(sender, args) { try { var elem = document.getElementById('AddFiles_Div'); elem.scrollTop = scrollTop; // I am always zero .................. alert(elem.scrollTop); } catch (err) {} } }); </script>\[/code\]C# Code that runs when a node is expanded .ie on Postback// Does some work and then runs the next lin.....\[code\]AddFilesModal.Show();\[/code\]
 
Back
Top