1
我已經創建了一個網站地圖與我的default.aspx頁面,相應地進行了編碼,然後添加了一個sitemapdatasource控件以及一個treeview控件到頁面。然後,我通過添加'datasourceID'來修改treeview的代碼,以便鏈接到sitemapdatasource。但在瀏覽器中查看頁面時我仍然遇到錯誤,不知道該怎麼辦。幫助將不勝感激。謝謝。Treeview不能與站點地圖工作
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Panel ID="Panel1" runat="server" BackColor="#DFDFFF" Font-Names="Arial"
Font-Size="Medium" Height="557px" Width="913px">
<asp:Panel ID="Panel2" runat="server" Width="223px" BackColor="#3333CC"
ForeColor="White"
style="top: 58px; left: 10px; position: absolute; height: 437px; margin-top: 70px; text-align: center;">
<asp:Panel ID="Panel3" runat="server" BackColor="#003399" ForeColor="White"
style="margin-left: 259px; top: -109px; left: -258px; position: absolute; width: 906px; height: 105px;">
<asp:Label ID="Label1" runat="server" Font-Size="XX-Large"
style="z-index: 1; left: 293px; top: 33px; position: absolute; width: 345px; text-align: center;"
Text="Web Page Header"></asp:Label>
</asp:Panel>
<asp:Label ID="Label2" runat="server" Font-Bold="True" ForeColor="White"
style="z-index: 1; left: 56px; top: 7px; position: absolute; width: 99px"
Text="Menu"></asp:Label>
<br />
<br />
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
<asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1">
</asp:TreeView>
</asp:Panel>
</asp:Panel>
</div>
</form>
</body>
</html>
代碼網站地圖:
<?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="this is the home page">
<siteMapNode url="Aboutus.aspx" title="About us" description="this is the contact page" />
<siteMapNode url="Contactus.aspx" title="Contact Us" description="this is the whatever page" />
<siteMapNode url="History.aspx" title="Our History" description="this is the whatever page" />
</siteMapNode>
</siteMap>
三個嵌套面板? – IrishChieftain 2012-04-11 13:45:32
這是我的根本原因嗎? – user1275084 2012-04-11 13:54:39
XmlSiteMapProvider所需的文件web.sitemap不存在。 這是我在請求頁面時得到的錯誤。 – user1275084 2012-04-11 13:56:55