1
私はdefault.aspxページでサイトマップを作成し、それに応じてコーディングしてから、サイトマップデータソースコントロールとツリービューコントロールをページに追加しました。私はそれをsitemapdatasourceにリンクするための 'datasourceID'を追加して、ツリービューのコードを変更しました。私はまだブラウザでページを表示しているときに何か他のことを知らずにエラーが表示されます。ヘルプをいただければ幸いです。ありがとうございました。サイトマップのためのサイトマップでツリービューが動作しない
<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>
コード:あなたのASPXページで
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="~/Home" title="Home" description="Home">
<siteMapNode url="~/About" title="About" description="About">
</siteMapNode>
</siteMap>
:
<?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>
3つのネストされたパネル?? – IrishChieftain
それは私の根本的な原因ですか? – user1275084
XmlSiteMapProviderに必要なweb.sitemapファイルが存在しません。 これはページをリクエストしたときに表示されるエラーです。 – user1275084