Solved

Hyperlink like a button with relative (not absolute) links

Posted on 2009-05-04
5
371 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
[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
  • 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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

726 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