Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp.net 4 trying to create a hyperlink in code behind

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
this does nothing, althought in debug it goes line by line but there is no hyperlink anywhere that I can see. I want to create hyperlinks dynamically based on users.
What am I doing wrong?
Code:
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim UserRights As String = "Resource"

        If UserRights = "Resource" Then

            Dim hyp = New HyperLink()
            hyp.ID = "AddTime"
            hyp.NavigateUrl = "~/mypage.aspx"
            Page.Controls.Add(hyp)
        End If
    End Sub

DougP
 
You need to set the "Text" property to something.
The hyperlink is being created and rendered to the page. You are not seeing it because it is rendering this:
<a id="AddTime" href="mypage.aspx"></a>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top