Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

forcing a div in an updatepanel to scroll down when the updatepanel is refreshed - how?

$
0
0

Suppose I have an updatepanel with a div inside it.  (actually, the div itself is really an asp.net panel control, but that probably doesn't matter).  I want the div  to scroll down.

So what I did was this:

function pageLoad() {
            // equivalent of document.ready, but fires even when updatepanel refreshes
             scrolldown = document.getElementById('HiddenFieldScroll').value;
            if (scrolldown) {
                var sh = $('#Panelmessages').prop("scrollHeight");$('#Panelmessages').scrollTop(sh);
            }
        }

The above is a javascript function, that is supposed to fire whenever the updatepanel is refreshed.  It checks a hidden field variable that is in the updatepanel and has clientidmode of static:

<asp:HiddenField ID="HiddenFieldScroll" runat="server" ClientIDMode="Static"></asp:HiddenField>

It works, EXCEPT, that it acts as if that hidden field is always true!  I cannot scroll upward without the div then scrolling back down.

Why would that be?  is the hiddenfieldvalue not updated before the variable is checked?

-- Gid


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>