Creating hyperlinks dynamically

Joined
Oct 30, 2007
Messages
1
Reaction score
0
Hi,
I am new to .NET and facing with the following problem.
I created a User control that would contain the following.
Home > Page1 > Page2 > ... so on.
The above link needs to be generated based on where the user is.
I have the logic, but no matter what I do, the links are not showing up.
Plz help.
Here is the code...
Protected Sub FirstPageLoad()
Dim lnkMenu As HyperLink
lnkMenu = New HyperLink
lnkMenu.ID = "link1"
lnkMenu.Text = SiteMap.RootNode.Title ' home
lnkMenu.NavigateUrl = SiteMap.RootNode.Url 'home.aspx
PlaceHolder1.Controls.Add(lnkMenu)

Try
If (SiteMap.RootNode.HasChildNodes) Then
Dim ChildNodesEnumerator As IEnumerator = SiteMap.RootNode.ChildNodes.GetEnumerator()
Response.Write(" > ")
While (ChildNodesEnumerator.MoveNext())
' Prints the Title.
If ChildNodesEnumerator.Current.ToString() = "Page1" Then
lnkMenu.Text = ChildNodesEnumerator.Current.ToString()
lnkMenu.NavigateUrl = "page1.aspx"
Response.Write(" > ")
Response.Write(SiteMap.CurrentNode.Title)
Exit While
End If
End While
End If
Finally
End Try
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top