显示一组文本或图像超链接,用户通过它们可以轻松地在网站内导航,同时占用最小的页空间量。
|
---|
<asp:SiteMapPath
????AccessKey="string"
????BackColor="color name|#dddddd"
????BorderColor="color name|#dddddd"
????BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge|
Inset|Outset"
????BorderWidth="size"
????CssClass="string"
????Enabled="True|False"
????EnableTheming="True|False"
????EnableViewState="True|False"
????Font-Bold="True|False"
????Font-Italic="True|False"
????Font-Names="string"
????Font-Overline="True|False"
????Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium|
Large|X-Large|XX-Large"
????Font-Strikeout="True|False"
????Font-Underline="True|False"
????ForeColor="color name|#dddddd"
????Height="size"
????ID="string"
????OnDataBinding="DataBinding event handler"
????OnDisposed="Disposed event handler"
????OnInit="Init event handler"
????OnItemCreated="ItemCreated event handler"
????OnItemDataBound="ItemDataBound event handler"
????OnLoad="Load event handler"
????OnPreRender="PreRender event handler"
????OnUnload="Unload event handler"
????ParentLevelsDisplayed="integer"
????PathDirection="RootToCurrent|CurrentToRoot"
????PathSeparator="string"
????RenderCurrentNodeAsLink="True|False"
????runat="server"
????ShowToolTips="True|False"
????SiteMapProvider="string"
????SkinID="string"
????SkipLinkText="string"
????Style="string"
????TabIndex="integer"
????ToolTip="string"
????Visible="True|False"
????Width="size"
>
????????<CurrentNodeStyle />
????????<CurrentNodeTemplate>
<!-- child controls -->
????????</CurrentNodeTemplate>
????????<NodeStyle />
????????<NodeTemplate>
<!-- child controls -->
????????</NodeTemplate>
????????<PathSeparatorStyle />
????????<PathSeparatorTemplate>
<!-- child controls -->
????????</PathSeparatorTemplate>
????????<RootNodeStyle />
????????<RootNodeTemplate>
<!-- child controls -->
????????</RootNodeTemplate>
</asp:SiteMapPath> |
备注
示例
下面的代码示例演示如何在 Web 窗体页中以声明方式使用 SiteMapPath 控件,还演示一些优先级规则,这些规则控制向 SiteMapPath 节点应用模板和样式的顺序。
此示例使用默认站点地图提供程序以及一个具有以下结构的 Web.sitemap 文件。
? | 复制代码 |
---|
<siteMap>
<siteMapNode title="WebForm1" description="WebForm1" url="WebForm1.aspx" >
<siteMapNode title="WebForm2" description="WebForm2" url="WebForm2.aspx"/>
</siteMapNode>
</siteMap> |
Visual Basic? | 复制代码 |
---|
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<SCRIPT runat="server">
</SCRIPT>
<HTML>
<BODY>
<FORM runat="server">
<!-- The following example demonstrates some of the orders
of precedence when applying styles and templates to
functional nodes of a SiteMapPath.
The NodeStyle and RootNodeStyle define the same attributes,
but are different and conflict with each other: the
RootNodeStyle supersedes NodeStyle, and is the style
rendered. Notice, however, that the underline style
defined by NodeStyle is still applied.
Both a CurrentNodeStyle and a CurrentNodeTemplate are
defined. A template supersedes a style for a node
type, so CurrentNodeTemplate is displayed and CurrentNodeStyle
is ignored. -->
<asp:SiteMapPath ID="SiteMapPath1" runat="server"
RenderCurrentNodeAsLink="true"
NodeStyle-Font-Name="Franklin Gothic Medium"
NodeStyle-Font-Underline="true"
NodeStyle-Font-Bold="true"
RootNodeStyle-Font-Name="Symbol"
RootNodeStyle-Font-Bold="false"
CurrentNodeStyle-Font-Name="Verdana"
CurrentNodeStyle-Font-Size="10pt"
CurrentNodeStyle-Font-Bold="true"
CurrentNodeStyle-ForeColor="red"
CurrentNodeStyle-Font-Underline="false"
HoverNodeStyle-ForeColor="blue"
HoverNodeStyle-Font-Underline="true">
<CURRENTNODETEMPLATE>
<asp:Image id="Image1" runat="server" ImageUrl="WebForm2.jpg" AlternateText="WebForm2"/>
</CURRENTNODETEMPLATE>
</asp:SiteMapPath>
</FORM>
</BODY>
</HTML>
|
C#? | 复制代码 |
---|
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<SCRIPT runat="server">
</SCRIPT>
<HTML>
<BODY>
<FORM runat="server">
<!-- The following example demonstrates some of the orders
of precedence when applying styles and templates to
functional nodes of a SiteMapPath.
The NodeStyle and RootNodeStyle define the same attributes,
but are different and conflict with each other: the
RootNodeStyle supersedes NodeStyle, and is the style
rendered. Notice, however, that the underline style
defined by NodeStyle is still applied.
Both a CurrentNodeStyle and a CurrentNodeTemplate are
defined. A template supersedes a style for a node
type, so CurrentNodeTemplate is displayed and CurrentNodeStyle
is ignored. -->
<asp:SiteMapPath ID="SiteMapPath1" runat="server"
RenderCurrentNodeAsLink="true"
NodeStyle-Font-Name="Franklin Gothic Medium"
NodeStyle-Font-Underline="true"
NodeStyle-Font-Bold="true"
RootNodeStyle-Font-Name="Symbol"
RootNodeStyle-Font-Bold="false"
CurrentNodeStyle-Font-Name="Verdana"
CurrentNodeStyle-Font-Size="10pt"
CurrentNodeStyle-Font-Bold="true"
CurrentNodeStyle-ForeColor="red"
CurrentNodeStyle-Font-Underline="false"
HoverNodeStyle-ForeColor="blue"
HoverNodeStyle-Font-Underline="true">
<CURRENTNODETEMPLATE>
<asp:Image id="Image1" runat="server" ImageUrl="WebForm2.jpg" AlternateText="WebForm2"/>
</CURRENTNODETEMPLATE>
</asp:SiteMapPath>
</FORM>
</BODY>
</HTML>
|
J#? | 复制代码 |
---|
<%@ Page Language="VJ#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<SCRIPT runat="server">
</SCRIPT>
<HTML>
<BODY>
<FORM runat="server">
<!-- The following example demonstrates some of the orders
of precedence when applying styles and templates to
functional nodes of a SiteMapPath.
The NodeStyle and RootNodeStyle define the same attributes,
but are different and conflict with each other: the
RootNodeStyle supercedes NodeStyle, and is the style
rendered. Notice, however, that the underline style
defined by NodeStyle is still applied.
Both a CurrentNodeStyle and a CurrentNodeTemplate are
defined. A template supercedes a style for a node
type, so CurrentNodeTemplate is displayed and CurrentNodeStyle
is ignored. -->
<asp:SiteMapPath ID="SiteMapPath1" runat="server"
RenderCurrentNodeAsLink="true"
NodeStyle-Font-Name="Franklin Gothic Medium"
NodeStyle-Font-Underline="true"
NodeStyle-Font-Bold="true"
RootNodeStyle-Font-Name="Symbol"
RootNodeStyle-Font-Bold="false"
CurrentNodeStyle-Font-Name="Verdana"
CurrentNodeStyle-Font-Size="10pt"
CurrentNodeStyle-Font-Bold="true"
CurrentNodeStyle-ForeColor="red"
CurrentNodeStyle-Font-Underline="false"
HoverNodeStyle-ForeColor="blue"
HoverNodeStyle-Font-Underline="true">
<CURRENTNODETEMPLATE>
<asp:Image id="Image1" runat="server" ImageUrl="WebForm2.jpg" AlternateText="WebForm2"/>
</CURRENTNODETEMPLATE>
</asp:SiteMapPath>
</FORM>
</BODY>
</HTML>
|
请参见
参考
SiteMapPath
其他资源
ASP.NET 导航控件