Making a global back button in a web control

Dear Experts,

I'm trying to make a global 'back' button for my site.

I looked at this article, which seemed very useful (but is in c#)
http://codebetter.com/blogs/peter.van.ooijen/archive/2005/07/19/129384.aspx

I tried to convert it into VB.NET, but it's crashing every time I try to run it (included in my main project)

I'm getting a few warnings (overloads warnings), so that might have something to do with it. Can anybody suggest?

Thanks

NIck

Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Text
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
<ToolboxData("<{0}:GlobalBack runat=server></{0}:GlobalBack>")> _
Public Class GlobalBack
    Inherits HyperLink
    Private Sub GlobalBack_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Me.NavigateUrl = Page.Request.UrlReferrer.AbsoluteUri
            Me.OnLoad(e)
        End If
    End Sub
    <Browsable(False)> Public Overloads Property NavigateUrl() As String
        Get
            Return Me.NavigateUrl
        End Get

        Set(ByVal Value As String)

            'nothing

        End Set
    End Property

End Class
LVL 1
nkewneyAsked:
Who is Participating?
 
Bob LearnedConnect With a Mentor Commented:
Nick,

Here's the thing that I see, looking more closely:

1) Set the URL:
    MyBase.NavigateUrl = Page.Request.UrlReferrer.AbsoluteUri

2) Get the value:
   <Browsable(False)> Public Overloads ReadOnly Property NavigateUrl() As String
        Get
            Return MyBase.NavigateUrl
        End Get
    End Property

Bob
0
 
Bob LearnedCommented:
Try this:

<Browsable(False)> Public Overloads ReadOnly Property NavigateUrl() As String
        Get
            Return Me.NavigateUrl
        End Get
    End Property

Bob
0
 
nkewneyAuthor Commented:
Thanks Bob,

THis gives me

Error      57      Property 'NavigateUrl' is 'ReadOnly'.      D:\Projects\GLWebControls\GlobalBack.vb      13      13      GLWebControls

Thanks

Nick
0
 
craskinCommented:
i don't really understand why making a web control to place on every page is easier than simply directing Request.UrlReferrer.AbsoluteUri to a button on each page?
0
 
nkewneyAuthor Commented:
Apologies for the delay in awarding the points.

Nick
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.