SiteMapPath 未按预期显示站点地图
将
控件与下面的 Web.sitemap 文件一起使用:
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
<asp:SiteMapPath ID="SiteMapPath1" runat="server"></asp:SiteMapPath>
<asp:Image ID="Image1" runat="server" ImageUrl="~/closed-sign.jpg" Height="300" Width="400" />
运行时,它没有向我显示它应该显示的方式,如 此示例。
它只显示图像,没有站点地图。
如何解决这个问题?
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="Default.aspx" title="Home" description="Home Page">
<siteMapNode url="StandardToolBox.aspx" title="Standard ToolBox Control" description="Standard ToolBox Control">
<siteMapNode url="BulletedList.aspx" title="BulltedList Example" description="BulltedList Control Simple Example" />
<siteMapNode url="CheckBox.aspx" title="CheckBox Example" description="CheckBox Control Simple Example" />
<siteMapNode url="CheckBoxList.aspx" title="CheckBoxList Example" description="CheckBoxList Control Simple Example" />
<siteMapNode url="Image.aspx" title="Image Control Example" description="Image Control Simple Example"/>
</siteMapNode>
<siteMapNode url="DataToolBox.aspx" title="Data ToolBox Control" description="Data ToolBox Control">
<siteMapNode url="SqlDataSource.aspx" title="SqlDataSource Example" description="SqlDataSource Simple Example" />
<siteMapNode url="XmlDataSource.aspx" title="XmlDataSource Example" description="XmlDataSource Simple Example" />
</siteMapNode>
Using a <asp:SiteMapPath>
control with the Web.sitemap file below:
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
<asp:SiteMapPath ID="SiteMapPath1" runat="server"></asp:SiteMapPath>
<asp:Image ID="Image1" runat="server" ImageUrl="~/closed-sign.jpg" Height="300" Width="400" />
While running it's not showing me way it should show as in this example.
It's only showing the image, with no sitemap.
How can this be fixed?
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="Default.aspx" title="Home" description="Home Page">
<siteMapNode url="StandardToolBox.aspx" title="Standard ToolBox Control" description="Standard ToolBox Control">
<siteMapNode url="BulletedList.aspx" title="BulltedList Example" description="BulltedList Control Simple Example" />
<siteMapNode url="CheckBox.aspx" title="CheckBox Example" description="CheckBox Control Simple Example" />
<siteMapNode url="CheckBoxList.aspx" title="CheckBoxList Example" description="CheckBoxList Control Simple Example" />
<siteMapNode url="Image.aspx" title="Image Control Example" description="Image Control Simple Example"/>
</siteMapNode>
<siteMapNode url="DataToolBox.aspx" title="Data ToolBox Control" description="Data ToolBox Control">
<siteMapNode url="SqlDataSource.aspx" title="SqlDataSource Example" description="SqlDataSource Simple Example" />
<siteMapNode url="XmlDataSource.aspx" title="XmlDataSource Example" description="XmlDataSource Simple Example" />
</siteMapNode>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您使用的代码工作正常。
您正在查看的页面可能不在站点地图列表中的任何位置。
确保您在名为以下的页面上运行此示例:
这是一个面包屑控件。它只会显示返回其父级的链接。它不会向兄弟姐妹发送链接。
The code you're using works fine.
Likely the page you're looking at is NOT anywhere in the list on the site map.
Ensure you're running this sample on a page named like:
This is a breadcrumb control. It will only show links back to its parents. It will not send links to siblings.