System.Web.UI.WebControls.SiteMapPath.CreateControlHierarchy Method

Examines the site map structure provided by the SiteMapPath.SiteMapProvider and builds a child controls collection based on the styles and templates defined for the functional nodes.

Syntax

protected virtual void CreateControlHierarchy ()

Remarks

The SiteMapPath.CreateControlHierarchy method creates System.Web.UI.WebControls.SiteMapNodeItem controls, associates them with the corresponding System.Web.SiteMapNode objects from the current site map provider, and adds the nodes to the System.Web.UI.Control.Controls collection.

The method begins by finding the System.Web.SiteMap.CurrentNode, and then walks up the hierarchical tree of System.Web.SiteMapNode objects, creating a System.Web.UI.WebControls.SiteMapNodeItem for each one until the System.Web.SiteMap.RootNode is reached. After each System.Web.UI.WebControls.SiteMapNodeItem is created, but before it is bound to its corresponding System.Web.SiteMapNode, the SiteMapPath.InitializeItem(SiteMapNodeItem) method is called. The SiteMapPath.InitializeItem(SiteMapNodeItem) method applies any templates or styles defined for a particular node type and creates and initializes any child controls that the System.Web.UI.WebControls.SiteMapNodeItem contains. Finally, the SiteMapPath.InitializeItem(SiteMapNodeItem) method adds the child controls of the System.Web.UI.WebControls.SiteMapNodeItem to the System.Web.UI.Control.Controls collection.

After each System.Web.UI.WebControls.SiteMapNodeItem is initialized, the SiteMapPath.OnItemCreated(SiteMapNodeItemEventArgs) method is called. Then the System.Web.UI.WebControls.SiteMapNodeItem is bound to its corresponding System.Web.SiteMapNode, and BaseDataBoundControl.OnDataBound(EventArgs) is called.

The SiteMapPath.CreateControlHierarchy method is called from the SiteMapPath.CreateChildControls method.

Classes that extend the System.Web.UI.WebControls.SiteMapPath control override the SiteMapPath.CreateControlHierarchy method to alter how the System.Web.UI.WebControls.SiteMapNodeItem controls are created or added to the System.Web.UI.WebControls.SiteMapPath control. The manipulation of individual node items is performed in the SiteMapPath.InitializeItem(SiteMapNodeItem) method, and most classes that extend System.Web.UI.WebControls.SiteMapPath override that method only.

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0