本文整理汇总了VB.NET中System.Web.SiteMapNodeCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:VB.NET SiteMapNodeCollection.Add方法的具体用法?VB.NET SiteMapNodeCollection.Add怎么用?VB.NET SiteMapNodeCollection.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.SiteMapNodeCollection 的用法示例。
在下文中一共展示了SiteMapNodeCollection.Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: LoadSiteMapData
' The LoadSiteMapData() Function loads site navigation
' data from persistent storage into a DataTable.
Dim siteMapData As DataTable
siteMapData = LoadSiteMapData()
' Create a SiteMapNodeCollection.
Dim nodes As New SiteMapNodeCollection()
' Create a SiteMapNode and add it to the collection.
Dim tempNode As SiteMapNode
Dim row As DataRow
Dim index As Integer
index = 0
While (index < siteMapData.Rows.Count)
row = siteMapData.Rows(index)
' Create a node based on the data in the DataRow.
tempNode = New SiteMapNode(SiteMap.Provider, row("Key").ToString(), row("Url").ToString())
' Add the node to the collection.
nodes.Add(tempNode)
index = index + 1
End While
开发者ID:VB.NET开发者,项目名称:System.Web,代码行数:26,代码来源:SiteMapNodeCollection.Add
示例2: GetChildNodes
' Implement the GetChildNodes method.
Public Overrides Function GetChildNodes(ByVal node As SiteMapNode) As SiteMapNodeCollection
Dim children As New SiteMapNodeCollection()
' Iterate through the ArrayList and find all nodes that have the specified node as a parent.
SyncLock Me
Dim i As Integer
For i = 0 To childParentRelationship.Count - 1
Dim de As DictionaryEntry = CType(childParentRelationship(i), DictionaryEntry)
Dim nodeUrl As String = CType(de.Key, String)
Dim parent As SiteMapNode = GetNode(childParentRelationship, nodeUrl)
If Not (parent Is Nothing) AndAlso node.Url = parent.Url Then
' The SiteMapNode with the Url that corresponds to nodeUrl
' is a child of the specified node. Get the SiteMapNode for
' the nodeUrl.
Dim child As SiteMapNode = FindSiteMapNode(nodeUrl)
If Not (child Is Nothing) Then
children.Add(CType(child, SiteMapNode))
Else
Throw New Exception("ArrayLists not in sync.")
End If
End If
Next i
End SyncLock
Return children
End Function 'GetChildNodes
Protected Overrides Function GetRootNodeCore() As SiteMapNode
Return RootNode
End Function ' GetRootNodeCore()
' Implement the GetParentNode method.
Public Overrides Function GetParentNode(ByVal node As SiteMapNode) As SiteMapNode
' Check the childParentRelationship table and find the parent of the current node.
' If there is no parent, the current node is the RootNode.
Dim parent As SiteMapNode = Nothing
SyncLock Me
' Get the Value of the node in childParentRelationship
parent = GetNode(childParentRelationship, node.Url)
End SyncLock
Return parent
End Function 'GetParentNode
开发者ID:VB.NET开发者,项目名称:System.Web,代码行数:44,代码来源:SiteMapNodeCollection.Add
注:本文中的System.Web.SiteMapNodeCollection.Add方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论