XmlSiteMapProvider.AddNode(SiteMapNode, SiteMapNode) 方法


SiteMapNode 物件新增至目前提供者所維護的集合中。Adds a SiteMapNode object to the collections that are maintained by the current provider.

protected public:
 override void AddNode(System::Web::SiteMapNode ^ node, System::Web::SiteMapNode ^ parentNode);
protected internal override void AddNode (System.Web.SiteMapNode node, System.Web.SiteMapNode parentNode);
override this.AddNode : System.Web.SiteMapNode * System.Web.SiteMapNode -> unit
Protected Friend Overrides Sub AddNode (node As SiteMapNode, parentNode As SiteMapNode)



要新增至提供者的 SiteMapNodeThe SiteMapNode to add to the provider.


SiteMapNode,在其底下加入 nodeThe SiteMapNode under which to add node.


nodeparentNodenullnode or parentNode is null.

目前的 XmlSiteMapProvider 不是與 node 相關聯的提供者。The current XmlSiteMapProvider is not the provider associated with node.

XmlSiteMapProvider 中已註冊了具有相同 URL 或索引鍵的節點。A node with the same URL or key is already registered with the XmlSiteMapProvider. - 或 -- or - 發現重複的網站地圖節點 (例如當兩個網站地圖提供者以程式設計方式連結時)。A duplicate site map node has been encountered programmatically, such as when linking two site map providers.

-或--or- nodeXmlSiteMapProvider 的根節點。node is the root node of the XmlSiteMapProvider.


node參數會加入至內部集合,並在其和之間建立父子式關聯性 parentNodeThe node parameter is added to an internal collection, and a parent/child relationship is created between it and parentNode.

XmlSiteMapProvider衍生自類別的類別 StaticSiteMapProvider 和 ASP.NET 的預設網站地圖提供者, Url 預設會 SiteMapNode 在其內部集合中使用物件的屬性做為查閱索引鍵。The XmlSiteMapProvider class, derived from the StaticSiteMapProvider class and the default site map provider for ASP.NET, uses the Url property of a SiteMapNode object as a lookup key in its internal collections, by default. 如果 Url 設定的屬性 SiteMapNode ,則在提供者的範圍內必須是唯一的。If the Url property of the SiteMapNode is set, it must be unique within the scope of the provider. FindSiteMapNode方法會嘗試根據節點來取得節點 UrlThe FindSiteMapNode method attempts to retrieve nodes based on their Url. 否則,您可以使用 Key 屬性和對應的 FindSiteMapNodeFromKey 方法來取出節點。Otherwise, you can use the Key property, and the corresponding FindSiteMapNodeFromKey method, to retrieve nodes.