本文整理匯總了VB.NET中System.Web.UI.IHierarchyData.Item屬性的典型用法代碼示例。如果您正苦於以下問題:VB.NET IHierarchyData.Item屬性的具體用法?VB.NET IHierarchyData.Item怎麽用?VB.NET IHierarchyData.Item使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.Web.UI.IHierarchyData
的用法示例。
在下文中一共展示了IHierarchyData.Item屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: PrintFullChildNodeInfo
' Print out the current data node, then iterate through its
' children and do the same.
Private Sub PrintFullChildNodeInfo(ByVal node As IHierarchyData)
Dim whitespace As String = " "
Dim br As String = "<BR>"
Response.Write(Convert.ToString(node) & br)
Response.Write(whitespace & node.Path & br)
' Check for specific types and perform extended functions.
If node.Type = "SiteMapNode" Then
' Because SiteMapNode implements the IHierarchyData interface,
' the IHierarchyData object can be cast directly as a SiteMapNode,
' rather than accessing the Item property for the object that
' the Type property identifies.
Dim siteNode As SiteMapNode = CType(node.Item, SiteMapNode)
Response.Write(whitespace & siteNode.Url & br)
Response.Write(whitespace & siteNode.Description & br)
ElseIf node.Type = "SomeBusinessObject Then" Then
' If the IHierarchyData instance is a wrapper class on a business
' object of some kind, you can retrieve the business object by using
' the IHierarchyData.Item property.
' SomeBusinessObject busObj = node.Item as SomeBusinessObject;
End If
If node.HasChildren Then
Dim children As IEnumerator = CType(node.GetChildren().GetEnumerator(), IHierarchicalEnumerable)
While children.MoveNext()
' Print out SiteMapNode Titles recursively.
Dim hierarchicalNode As IHierarchyData = node.GetChildren().GetHierarchyData(children.Current)
PrintFullChildNodeInfo(hierarchicalNode)
End While
End If
End Sub