moving to an anchor point programmatically

  • Thread starter Thread starter Craig Phillips
  • Start date Start date
C

Craig Phillips

Hi,
Does anyone know how to programmatically move to a anchor point (a tag). I
am using vb.net. When the user presses a server-side control on the webpage,
I need to do some server processing and then I would like the resultant page
to have scrolled down half-way to the relevent part. Any help much
appreciated.
 
When the page posts back, use RegisterStartUpScript() to add a script like
the following to your page, to be run as soon as the page loads:

<script type="text/javascript"><!--
document.location = "#tagName";
// --></script>

HTH,

Kevin Spencer
Microsoft FrontPage MVP
Internet Developer
http://www.takempis.com
Some things just happen.
Everything else occurs.
 
The easy way is to do a response.redirect to that spot:

Response.Redirect("mypage.aspx#tagName")

Note, however, that this forces two calls from the client. Not a problem if
you are using viewState and do not have a very large viewState, but not
optimal in all situations. Note, also, that this is largely an HTML/HTTP
problem.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Author: ADO.NET and XML: ASP.NET on the Edge

****************************************************************************
****
Think Outside the Box!
****************************************************************************
****
 
Back
Top