SiteMapPath.CreateControlHierarchy 方法

定义

检查 SiteMapProvider 提供的站点地图结构,并根据为功能节点定义的样式和模板生成子控件集合。Examines the site map structure provided by the SiteMapProvider and builds a child controls collection based on the styles and templates defined for the functional nodes.

protected:
 virtual void CreateControlHierarchy();
protected virtual void CreateControlHierarchy ();
abstract member CreateControlHierarchy : unit -> unit
override this.CreateControlHierarchy : unit -> unit
Protected Overridable Sub CreateControlHierarchy ()

异常

没有 SiteMapProvider 可用于 SiteMapPath 控件。No SiteMapProvider is available to the SiteMapPath control.

注解

方法创建SiteMapNodeItem控件, 将它们与当前站点地图Controls提供SiteMapNode程序中的相应对象关联, 并将这些节点添加到集合中。 CreateControlHierarchyThe CreateControlHierarchy method creates SiteMapNodeItem controls, associates them with the corresponding SiteMapNode objects from the current site map provider, and adds the nodes to the Controls collection.

方法首先查找SiteMap.CurrentNode, 然后向上遍历SiteMapNode对象的层次结构树, 为每个对象创建一个SiteMapNodeItem , 直到RootNode达到为止。The method begins by finding the SiteMap.CurrentNode, and then walks up the hierarchical tree of SiteMapNode objects, creating a SiteMapNodeItem for each one until the RootNode is reached. 创建每SiteMapNodeItem个后, 但在将其绑定到相应SiteMapNode的后, InitializeItem将调用方法。After each SiteMapNodeItem is created, but before it is bound to its corresponding SiteMapNode, the InitializeItem method is called. 方法应用为特定节点类型定义的任何模板或样式, 并创建并初始化SiteMapNodeItem包含的任何子控件。 InitializeItemThe InitializeItem method applies any templates or styles defined for a particular node type and creates and initializes any child controls that the SiteMapNodeItem contains. 最后, InitializeItem方法将的子控件SiteMapNodeItem添加到Controls集合中。Finally, the InitializeItem method adds the child controls of the SiteMapNodeItem to the Controls collection.

每次SiteMapNodeItem初始化后, 将OnItemCreated调用方法。After each SiteMapNodeItem is initialized, the OnItemCreated method is called. 然后, 将绑定到相应SiteMapNode的, 并OnDataBound调用。 SiteMapNodeItemThen the SiteMapNodeItem is bound to its corresponding SiteMapNode, and OnDataBound is called.

CreateControlHierarchy 方法CreateChildControls从方法中调用。The CreateControlHierarchy method is called from the CreateChildControls method.

扩展SiteMapPath控件的类会CreateControlHierarchy重写SiteMapNodeItem方法, 以改变控件创建或添加到SiteMapPath控件的方式。Classes that extend the SiteMapPath control override the CreateControlHierarchy method to alter how the SiteMapNodeItem controls are created or added to the SiteMapPath control. 单个节点项的操作是在InitializeItem方法中执行的, 大多数扩展SiteMapPath的类只重写此方法。The manipulation of individual node items is performed in the InitializeItem method, and most classes that extend SiteMapPath override that method only.

适用于

另请参阅