Geeks With Blogs
faizan ahmad Usually the things which were not a straight Google
If you have a gridview/repeater control or other tabular data within a div, scroll bar appears when height  of data gets bigger than that of DIV.
If you want to scroll down to a certain position, you can use 'Element.scrollTop' property in Javascript:

document.getElementById(divWithScroll').scrollTop = PixelsToScroll;

Calculating the PixelsToScroll may vary depending on scenerio,

In my case, I wanted to scroll down to a selected row within Repeater control. Row was selected using RadioButton and page was reloaded on selection of RadioButton. So, I saved the SelectedItem.ItemIndex  in Repeater_ItemDataBound in a hidden field and using the value in Javascript like following:

PixelsToScroll = SelectedItem * 22;

where 22 is height of table row Posted on Thursday, January 8, 2009 4:36 PM DHTML | Back to top


Comments on this post: Scroll Div on page load

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © faizanahmad | Powered by: GeeksWithBlogs.net