Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Can you jump to an anchor on postback?

Reply
Thread Tools

Can you jump to an anchor on postback?

 
 
darrel
Guest
Posts: n/a
 
      02-08-2005
I have an anchor on my page:

<a name="monkey"></a>

I can easily go to this via a redirect, but is there a way to jump to this
on postback?

-Darrel


 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      02-08-2005
Sure. Just add a JavaScript to the page that does the "redirect" -

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

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"darrel" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have an anchor on my page:
>
> <a name="monkey"></a>
>
> I can easily go to this via a redirect, but is there a way to jump to this
> on postback?
>
> -Darrel
>
>



 
Reply With Quote
 
 
 
 
Ollie Riches
Guest
Posts: n/a
 
      02-08-2005
check out using SmartNavigation for returning to the correct place on a page
after a post back

HTH

Ollie Riches

"darrel" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have an anchor on my page:
>
> <a name="monkey"></a>
>
> I can easily go to this via a redirect, but is there a way to jump to this
> on postback?
>
> -Darrel
>
>



 
Reply With Quote
 
darrel
Guest
Posts: n/a
 
      02-08-2005

> check out using SmartNavigation for returning to the correct place on a

page
> after a post back


Ha! The first result from google is:

"Smart navigation is more of a pain than good."

;o)

I'll look into it, though I'm thinking Kevin's answer might be the solution.
Not a big fan of javascript for this, but since this is on an intranet, it's
not as big of a deal.

-Darrel


 
Reply With Quote
 
darrel
Guest
Posts: n/a
 
      02-08-2005
> Sure. Just add a JavaScript to the page that does the "redirect" -
>
> <script type="text/javascript"><!--
> document.location = "thispage.aspx#bookmark";
> // --></script>


Hmm...does that reload the page or merely jump to the anchor? Would this
work as well:

document.location = "#bookmark";?

-Darrel


 
Reply With Quote
 
Ollie Riches
Guest
Posts: n/a
 
      02-08-2005
SmartNavigation is not a pain at all as long as you remember some very
important folders, make sure that the folders with the prefix '_vti_' are
included in the root directory of the installed asp.net application
otherwise you will see funny behaviour with SmartNavigation, by default they
are installed in \Inetpub\wwwroot automatically so you don't have to worry
about it if your asp.net application resides under this directory.

Also it only works in IE I believe, it does work in Firefox (Mozilla).

HTH

Ollie Riches


"darrel" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> > check out using SmartNavigation for returning to the correct place on a

> page
> > after a post back

>
> Ha! The first result from google is:
>
> "Smart navigation is more of a pain than good."
>
> ;o)
>
> I'll look into it, though I'm thinking Kevin's answer might be the

solution.
> Not a big fan of javascript for this, but since this is on an intranet,

it's
> not as big of a deal.
>
> -Darrel
>
>



 
Reply With Quote
 
Kevin Spencer
Guest
Posts: n/a
 
      02-08-2005
Sure. Six of one of half of one of half of a dozen of the other.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"darrel" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>> Sure. Just add a JavaScript to the page that does the "redirect" -
>>
>> <script type="text/javascript"><!--
>> document.location = "thispage.aspx#bookmark";
>> // --></script>

>
> Hmm...does that reload the page or merely jump to the anchor? Would this
> work as well:
>
> document.location = "#bookmark";?
>
> -Darrel
>
>



 
Reply With Quote
 
Kevin Spencer
Guest
Posts: n/a
 
      02-08-2005
> Not a big fan of javascript for this, but since this is on an intranet,
> it's


If you're not a big fan of JavaScript, you might as well forget about
ASP.Net, which relies heavily upon JavaScript for much of its functionality
(ViewState, PostBacks, etc)!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"darrel" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
>> check out using SmartNavigation for returning to the correct place on a

> page
>> after a post back

>
> Ha! The first result from google is:
>
> "Smart navigation is more of a pain than good."
>
> ;o)
>
> I'll look into it, though I'm thinking Kevin's answer might be the
> solution.
> Not a big fan of javascript for this, but since this is on an intranet,
> it's
> not as big of a deal.
>
> -Darrel
>
>



 
Reply With Quote
 
darrel
Guest
Posts: n/a
 
      02-08-2005

> Also it only works in IE I believe


Hmm...well, there's my reason not to use it, I guess.

-Darrel


 
Reply With Quote
 
darrel
Guest
Posts: n/a
 
      02-08-2005

> If you're not a big fan of JavaScript, you might as well forget about
> ASP.Net, which relies heavily upon JavaScript for much of its

functionality
> (ViewState, PostBacks, etc)!


It's ridiculous, IMHO. I end up having to simply write a lot of workarounds
for it.

A server side language should not be dependant on client-side scripting, but
MS, as usual, took the easy way out on a lot of the built-in control
behaviors.

They're actually great to whip up quick interfaces on intranets where you
can control the client-side environment to an extent, but useless on the
greater web if accessibility is a concern.

IMHO, of course.

-Darrel


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Double left click jump to top, same with ctrl or shift to jump to bottom? Eadwine Rose Javascript 2 10-15-2006 08:38 PM
onClick() on an anchor that doesn't force the page to jump to thetop? Aaron Freeman HTML 7 03-17-2006 02:12 PM
Jump to named anchor after form processing Robert Mark Bram ASP General 3 10-20-2004 11:17 PM
How to jump to an anchor? Robert Wehofer ASP .Net 2 11-17-2003 11:51 PM
Perl Script creates html doc - want to jump to anchor TWW Perl Misc 1 07-16-2003 04:26 AM



Advertisments