Monday, March 26, 2012

How do I execute JS on page load after postback within an update panel?

I am trying to scroll the page after it loads between postbacks within an Update Panel. I used to have this work with beta 1

<script type="text/xml-script">
<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
<components>
<application load="onAutoScrollControlLoad" />
</components>
</page>
</script>

I am not sure how I came up with this, but it doesn't work with Beta 2 any more. Any ideas of how to implement the same functionality?

Thx
dB.

found a solution for this -http://forums.asp.net/thread/1418207.aspx

<scripttype="text/javascript">
function onAutoScrollControlLoad() { window.location.href ='#<% Response.Write(ScrollLocation); %>'; }
Sys.Application.add_load(function() { onAutoScrollControlLoad(); });
</script>

No comments:

Post a Comment