?
Solved

Hyperlink emulate Back Button

Posted on 2006-07-11
2
Medium Priority
?
441 Views
Last Modified: 2010-05-18
Hi, I am very new to ASP so apologies if this is very basic but any help to solve my problem would be very much appreciated.

I have a hyperlink that I want to act like the IE Back button, simply to go back one page.

Looking through Experts Exchange I think I need to use the following code

<a href="javascript:history.go(-1)"> back</a>

however, as I am programming in VB.Net I am unsure of where to put this in the ASP Code.

My hyperlink is currently in a table and the associated ASP code at the moment is

<tr>
        <td style="width: 100px">
            <asp:HyperLink ID="HyperLink1" runat="server" ForeColor="Red"
                Style="left: 8px; position: relative; top: 0px" Visible="False" Width="627px" >No Forthcoming Appointments Found</asp:HyperLink></td>
               
 </tr>
   
Can someone please help me by showing me how to make this hyperlink act like the Back button.

Thanks
...Steve
0
Comment
Question by:swtiley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 2000 total points
ID: 17080373
Hi swtiley,

You have two choices, you can either replace the asp:Hyperlink with a non server-control (<a href="....">Text</a>) or assign an onclick event programatically in page_load:

HyperLink1.Attributes.Add("OnClick","javascript:history.go(-1);")

Tim Cottee
0
 
LVL 1

Author Comment

by:swtiley
ID: 17080407
Thanks Tim, epecially for the quick response.

I took the pageload option, and works fine.

Cheers
...Steve
0

Featured Post

Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question