Monday, March 30, 2009

How to move vertical scroll bar using javascript in ASP.Net Web Form

Whenever ASP.NET Web Form page loaded, by defualt its focus set to first control (vertical scroll bar moved downward in this case) in the ASP.Net web form page. If you required to move your vertical scroll bar to the top of the page, then following client-side script help you in achieving this task:

<script>
function moveVerticalScroll()
{
document.body.scrollTop=0;
}
window.onload=
moveVerticalScroll;

</script>




Share:

1 comments:

Neal Holtschulte said...

FYI: this works when the script and function are in the head, but do NOT work when they're in the body.

Sitecore® Technology MVP 2019

Featured Post

Sitecore Error Troubleshooting: Sitecore Solr Connectivity Issue:: Part-1

Sitecore Error Troubleshooting: Sitecore Solr Connectivity Issue:: Part-1 How to verify Sitecore 9.1 (IaaS and Azure PaaS) + Solr (IaaS) C...

Total Pageviews

State Counder

Popular

About Me

My photo
Based in Bangalore, INDIA, Amit is a Sitecore MVP and MCC. He has an MCA from the U.P.T.U., INDIA and holds certifications including Sitecore and SharePoint 2007/2010. He is an contributor to Sitecore/MSDN communities and http://amitkumarmca04.blogspot.com/. Amit have experience in Sitecore, ASP.Net with C#, MVC, SharePoint, Classic ASP, VB,Macros,HTML,JavaScript,JSON,BootStrap and AngularJS.

Followers

Follow me on Twitter

Labels