Solved

Hyperlink emulate Back Button

Posted on 2006-07-11
2
437 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
2 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 500 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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

839 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