Wednesday, March 28, 2012

change scroll position on partial-page update?

I'm wanting to be able to change the scroll position to the bottom (or to an anchor) on an AJAX partial-page update. Any ideas? Can I fire a client-side javascript function after the update? Do I have to turn off MaintainScrollPositionOnPostback for the page?

Seehttp://forums.asp.net/t/1157991.aspx

Also, if you have specific scrolling logic when the UpdatePanel comes back, you can add it to EndRequest method in the following code (e.g. scrollTo)...

<script language="javascript" type="text/javascript"> var prm = Sys.WebForms.PageRequestManager.getInstance(); prm.add_initializeRequest(InitializeRequest); prm.add_endRequest(EndRequest); function InitializeRequest(sender, args) { ... } function EndRequest(sender, args) { ... } </script>

-Damien


Thanks... that's what I needed!

Brad


http://aspnet.4guysfromrolla.com/articles/111704-1.aspx

<pages smartNavigation="true"MaintainScrollPositionOnPostback="true"/>

Try this also

<script type="text/javascript"
var prm = Sys.WebForms.PageRequestManager.getInstance();

prm.add_beginRequest(beginRequest);

function beginRequest()
{
prm._scrollPosition = null;
}

</script>

Lety me know if this helpful to you

No comments:

Post a Comment