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
Solved

Hyperlink like a button with relative (not absolute) links

Posted on 2009-05-04
5
369 Views
Last Modified: 2012-05-06
Hi
This follows on from question 22578710 where a hyperlink need to look like a button.

I'd like the link <input type="button" value="Return to Main" onclick="location.href='/Default.aspx';" />

to be the same location as what ~/Default.aspx would generate, but ~/Default.aspx doesn't work. Neither does ../Default.aspx or ./Default.aspx - it takes me to root not a level down

(alteratively a solution with ASP.net hyperlink styled like a hyperlink would do)

Thank-you in advance
0
Comment
Question by:rwallacej
  • 3
5 Comments
 
LVL 10

Expert Comment

by:cdebel
ID: 24293950
This is how you should define a LinkButton in asp.net:

<asp:LinkButton ID="LinkButton2" runat="server" PostBackUrl="../default.aspx">LinkButton</asp:LinkButton>
0
 

Author Comment

by:rwallacej
ID: 24294157
hi
I tried the link button (see the original question http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_23765789.html) but it doesn't look like a button
thanks
0
 
LVL 10

Expert Comment

by:cdebel
ID: 24294168
because the it doesn't look flat?

Just set the background color, you won't get this 3D style anymore...
0
 
LVL 10

Accepted Solution

by:
cdebel earned 500 total points
ID: 24294195
forget what i said.  It apply to asp:button... not linkbutton.

Use an ASP:BUTTON like this:
<asp:Button ID="Button1" runat="server" Text="Button" />

and in the code-behind you can do this:
    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Page.Response.Redirect("../default.aspx")
    End Sub
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This article will show, step by step, how to integrate R code into a R Sweave document
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

790 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