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