SiteMapPath控件
关键属性
CurrentNodeStyle 当前节点的样式
CurrentNodeTemplate 当前节点的HTML模板
NodeStyle 非当前节点的样式
NodeStyleTemplate 非当前节点的HTML模板
PathSeparator 分隔符所使用的文字 (默认 = ">")
PathSeparatorStyle 分隔符的样式
PathSeparatorTemplate 分隔符所使用的HTML模板
RootNode 属性用来鉴别根节点
CurrentNode 属性用来鉴别当前节点
使用 Site Map API
// Write the title of the current node to a Label control
Label1.Text = SiteMap.CurrentNode.Title;
// Write the path to the current node to a Label control
SiteMapNode node = SiteMap.CurrentNode;
StringBuilder builder = new StringBuilder (node.Title);
while (node.ParentNode != null) {
node = node.ParentNode;
builder.Insert (0, " > ");
builder.Insert (0, node.Title);
}
Label1.Text = builder.ToString ();