Event firing [modified]
-
Hey guys I've tried most events that I have found on the net but none seem to fire when I want, it is almost as if there is no event being fired. I have a scrollable panel in my asp.net page and want to maintain the scroll position. First I tried to do it through .Net using the MaintainScrollPoisition property but that didn't work. I then turned to javascript to try and get the job done, I have two methods, one that saves the position and one the sets the position of the scrollbar. The save method works fine on the onscroll event but I can't seem to find an event that fires after the panel (which renders as a div in html) has completly finished loading. I have tried using the window.onload to run it but the div doesn't actually have a scrollbar when this fires. I then tried running it when the readyState is set to completed but that also runs before the panel has finished. Any help on what other events I can try will be much appreciated. Many thanks in advance. PS the panel is within a page in a masterpage in .Net but I don't think that should affect anything when doing it via javascript. -- modified at 4:17 Tuesday 27th November, 2007
-
Hey guys I've tried most events that I have found on the net but none seem to fire when I want, it is almost as if there is no event being fired. I have a scrollable panel in my asp.net page and want to maintain the scroll position. First I tried to do it through .Net using the MaintainScrollPoisition property but that didn't work. I then turned to javascript to try and get the job done, I have two methods, one that saves the position and one the sets the position of the scrollbar. The save method works fine on the onscroll event but I can't seem to find an event that fires after the panel (which renders as a div in html) has completly finished loading. I have tried using the window.onload to run it but the div doesn't actually have a scrollbar when this fires. I then tried running it when the readyState is set to completed but that also runs before the panel has finished. Any help on what other events I can try will be much appreciated. Many thanks in advance. PS the panel is within a page in a masterpage in .Net but I don't think that should affect anything when doing it via javascript. -- modified at 4:17 Tuesday 27th November, 2007
Have you tried this sample?? Maintain Scroll Position of DIV using JavaScript - ASP.NET 2.0
asp.net learner wrote:
I can't seem to find an event that fires after the panel (which renders as a div in html) has completly finished loading.
What do you want to do after the DIV has finished loading?
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)
-
Have you tried this sample?? Maintain Scroll Position of DIV using JavaScript - ASP.NET 2.0
asp.net learner wrote:
I can't seem to find an event that fires after the panel (which renders as a div in html) has completly finished loading.
What do you want to do after the DIV has finished loading?
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)
Hi Michael, thanks for the reply. The code you provided is similar to what I currently have but as yet doesn't work, the only difference being that I am using hidden fields to store the position of the scroll rather than a cookie. When I put an alert in with the function after setting the scrolltop, the page and all the information is there and visible when the alert pops up but the DIV doesn't have any scrollbars yet (it just carries on through the bottom of the page). Once ok is pressed the DIV appears to resize (no resize event fires...) and then the scrollbars appear. Setting the scrolltop property when no scrollbar is present does not change the value, it stays at 0. That is what I want to do when the DIV has finished loading and the scrollbar is present, set the position of the scrollbar. Can the resizing be due to the DIV having it's width and height being set as a percentage rather than an absolute? -- modified at 4:27 Friday 30th November, 2007