Hello,
I would like to preserve a grid's vertical scroll position across asynchronous postbacks.
I have an Infragistics UltraWebGrid control inside a div, which is inside an UpdatePanel, on a page with 4 UpdatePanel controls. Each UpdatePanel has UpdateMode = Conditional and I will typically .Update() 3 or 4 of the UpdatePanels during the same event. I want to either remember or reset the vertical scroll position across asynchronous postbacks. Setting the grid's div.scrollTop value works. The problem is scrollTop gets reset back to 0 on asynchronous postbacks by line 1321, "window.scrollTo(...)" in function "Sys$WebForms$PageRequestManager$_scriptsLoadComplete" in file "MicrosoftAjaxWebForms.debug.js". I have currently kludged the code using a setTimeout("...grid.DivElement.scrollTop = ...", 100);, which I call from the Sys.WebForms.PageRequestManager's endRequestHandler. The timeout was the only way I could find to set scrollTop to execute after line 1321 above. On aysnchronous postbacks, you can see the scroll position get reset to zero (line 1321), then scroll to the correct position.
Ideally, I would like to prevent line 1321 from executing. I have tried, to no avail, setting the pageRequestManager._scrollPosition to null during various events, (pageLoaded, initializeRequest, beginRequest, endRequest). However, if line 1321 must execute, then I would like to apply my scrollTop code w/o using the setTimeout function since I suspect the timeout duration that works on my machine may not work on slower or busier machines.
Does anyone have any suggestions?
-Greg Peters
Just a suggestion - is it possible to not set Height for the UltraWebGrids on the page at all (so that they span all the way down) but rather set the height of their respective <div> containers (you can add <div> containers if you do not have ones set), e.g.
<div style="height: 500px; overflow: scroll">
<igtbl:UltraWebGrid ...
</div>
This way, the scrollbars will be controlled by the parent <div> rather than the grid itself and you will have better control on them durng UpdatePanel updates (and you will not rely on like 1321 for setting the scrollbar position).
Just a suggestion, hope it helps.
Hi Rumen,
Thanks for the idea, but I need to scroll the rows under stationary column headers. So, it seems I must let the grid control the scrolling, rather than the parent div.
Thanks again.