Reposition the Page after PostBack

gprabaka

Newcomer
Joined
Jul 14, 2005
Messages
21
Hello,

I have an ASP.NET page on which I have 5 GridViews. On each gridview I have a link column which will display the child info on the next gridview. When I click and display the next gridview I want to make the page scroll down to the location of that gridview, without the user having to scroll down. Can anyone tell me a good way to do this.
Thanks
Guha
 
you could use a javascript function and then when the link is clicked call RegisterStartupScript or add onclick attribute to link when it is databound in the grid. i'm sure there are other ways but this is how i've done it.

Page.RegisterStartupScript("ScrollToPosition", String.Format("<script language='javascript'>ScrollToElem('{0}')</script>", String));

<script type="text/javascript" language="javascript">
function ScrollToElem(elemId)
{
var elem = document.getElementById(elemId);
if (elem == null) {
return;
}
elem.scrollIntoView(true);
}
</script>


-lp
 
Back
Top