Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • 2 weeks later...
Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...