moving to an anchor point programmatically

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.
 
K

Kevin Spencer

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.
 
C

Cowboy \(Gregory A. Beamer\)

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,265
Messages
2,571,069
Members
48,771
Latest member
ElysaD

Latest Threads

Top