Populates a System.Web.UI.WebControls.SiteMapNodeItem, which is a Web server control that represents a System.Web.SiteMapNode, with a set of child controls based on the node's function and the specified templates and styles for the node.
- item
- The System.Web.UI.WebControls.SiteMapNodeItem to initialize.
The SiteMapPath.InitializeItem(SiteMapNodeItem) method determines the functional type of node that the item represents by checking the System.Web.UI.WebControls.SiteMapNodeItemType, and applies any templates or styles that are defined for that kind of node.
If the System.Web.UI.WebControls.SiteMapNodeItem has a SiteMapNodeItemType.Root item type, a System.Web.UI.WebControls.HyperLink child control is created, and the SiteMapPath.RootNodeTemplate and SiteMapPath.RootNodeStyle may be applied. If the SiteMapPath.RootNodeTemplate is set, its System.Web.UI.ITemplate is applied to the node. In instead the SiteMapPath.RootNodeStyle is set, it is merged with any defined SiteMapPath.NodeStyle and applied. Finally, if no templates or styles are defined, a basic System.Web.UI.WebControls.HyperLink control is created and initialized with values from the node.
If the System.Web.UI.WebControls.SiteMapNodeItem has a SiteMapNodeItemType.Current item type, either a System.Web.UI.WebControls.Literal or System.Web.UI.WebControls.HyperLink child control is created, depending on the return value of SiteMapPath.RenderCurrentNodeAsLink. Then either the SiteMapPath.CurrentNodeTemplate or SiteMapPath.CurrentNodeStyle may be applied. If the SiteMapPath.CurrentNodeTemplate is set, its System.Web.UI.ITemplate is applied to the node. If instead the SiteMapPath.CurrentNodeStyle is set, it is merged with any defined SiteMapPath.NodeStyle and applied.
If the System.Web.UI.WebControls.SiteMapNodeItem has a SiteMapNodeItemType.Parent item type, a System.Web.UI.WebControls.HyperLink child control is created and the SiteMapPath.NodeTemplate and SiteMapPath.NodeStyle may be applied. If the SiteMapPath.NodeTemplate is set, its System.Web.UI.ITemplate is applied to the node. If instead the SiteMapPath.NodeStyle is set, it is applied.
Finally, if the System.Web.UI.WebControls.SiteMapNodeItem has a SiteMapNodeItemType.PathSeparator item type, a System.Web.UI.WebControls.Literal child control is created and the SiteMapPath.PathSeparatorTemplate and SiteMapPath.PathSeparatorStyle are applied according to the same general rules defined for a SiteMapNodeItemType.Parent node type.
Override the SiteMapPath.InitializeItem(SiteMapNodeItem) method to manipulate individual System.Web.UI.WebControls.SiteMapNodeItem objects. If the design of the class requires more extensive control over how the System.Web.UI.WebControls.SiteMapNodeItem objects are created and added to the System.Web.UI.WebControls.SiteMapPath control, override the SiteMapPath.CreateControlHierarchy method.