|
Imports Microsoft.SharePoint.Publishing
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Xml.Linq
Namespace PrestoFX.MasterPages
Public Class PrestoFX : Inherits MasterPage
Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
MyBase.OnLoad(e)
Dim menu As Menu = DirectCast(FindControl("Menu1"), Menu)
Dim doc As XDocument = XDocument.Load("C:\Inetpub\wwwroot\wss\VirtualDirectories\80\web.sitemap")
Dim query = From c In doc.Element("menuitems").Elements("menuitem")
Dim parentItem As MenuItem
For Each element As XElement In query
parentItem = New MenuItem()
Dim subQuery = From c In element.Elements("menuitem")
For Each node As XElement In subQuery
Dim item As New MenuItem()
With item
.Text = node.Attribute("text")
.NavigateUrl = node.Attribute("navigateurl")
.ToolTip = node.Attribute("tooltip")
.ImageUrl = "tool.png"
End With
parentItem.ChildItems.Add(item)
Next
With parentItem
.Text = element.Attribute("text")
.NavigateUrl = element.Attribute("navigateurl")
.ToolTip = element.Attribute("tooltip")
.ImageUrl = "heart.png"
End With
menu.Items.Add(parentItem)
Next
AddCutomNodes(menu)
End Sub
Protected Sub AddCutomNodes(ByRef menu As Menu)
menu.Items.Add(New MenuItem("ZOMG NEW!!!!!"))
End Sub
End Class
End Namespace
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Thoroughly convinced by the simplicity of C# and the richness of the base class library, Jiang moved from Java/C++ to the Microsoft .NET platform after having completed his computer science degree. A few years into your run-of-the-mill business reporting projects, he discovered the fun of working with SharePoint and has since been more and more enamored with the breadth of the product. Sadly to say, not all projects involve heroic debugging sessions with parallel and concurrent programming and sometimes SharePoint designer is all he gets to plays with.