Click to See Complete Forum and Search --> : [RESOLVED] Scroll page to the top after postback


omarr226
08-24-2009, 10:43 PM
I need to know how to scroll the page to the top after a button is clicked. I have a page full of controls and need to move focus to the top of the page whenever the button is clicked (postback). Also, please note that the page is an ajax page. I know javascript is the one which will resolve my problem but how?

omarr226
08-24-2009, 10:45 PM
Also, I can't use the onclientclick property of that button as that button's clientclick already does someother javascript validation.
There is a message lable on the top of the page and I need to take the page focus and scroll to that label's view.

omarr226
08-25-2009, 10:40 AM
http://www.codedigest.com/CodeDigest/120-Move-Scroll-Page-to-Top-After-Asynchronous-Postback-in-UpdatePanel-in-ASP-Net-AJAX.aspx

omarr226
08-25-2009, 10:42 AM
and then in code behind -->

string strScript = "<SCRIPT LANGUAGE='JavaScript'> endRequest(); </SCRIPT>";
ClientScript.RegisterClientScriptBlock(this.GetType(), "ClientScript", strScript);