HI I am experimenting Menu server control
I have the Web.sitemap file with content:
I drag-dropped the SiteMapDataSource. If I am correct, it directly connects to the .sitemap file (as I did this for TreeView earlier, it worked)
Then I drag-dropped Menu server control, set its datadource to above SiteMapDataSource & hit F5. But did not showed up the content in .sitemap
as a hierarchy that unfolds on hovering, but showed all the contents statically on the page:
crome snapshot:
http://img707.imageshack.us/img707/2044/aspnetmenu.png
however Visual Studio shows it up correctly in the design view:
http://img88.imageshack.us/img88/7141/vsmenuctrl.png
Why is this?
ASPX code:
Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1">
</asp:Menu>
</div>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
</form>
</body>
</html>
Web.sitemap content:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode title="Home" description="Home Page" url="Default.aspx">
<siteMapNode title="News" description="The Latest News" url="News.aspx">
<siteMapNode title="U.S." description="U.S. News"
url="News.aspx?cat=us" />
<siteMapNode title="World" description="World News"
url="News.aspx?cat=world" />
<siteMapNode title="Technology" description="Technology News"
url="News.aspx?cat=tech" />
<siteMapNode title="Sports" description="Sports News"
url="News.aspx?cat=sport" />
</siteMapNode>
<siteMapNode title="Finance" description="The Latest Financial Information"
url="Finance.aspx">
<siteMapNode title="Quotes" description="Get the Latest Quotes"
url="Quotes.aspx" />
<siteMapNode title="Markets" description="The Latest Market Information"
url="Markets.aspx">
<siteMapNode title="U.S. Market Report"
description="Looking at the U.S. Market" url="MarketsUS.aspx" />
<siteMapNode title="NYSE"
description="The New York Stock Exchange" url="NYSE.aspx" />
</siteMapNode>
<siteMapNode title="Funds" description="Mutual Funds"
url="Funds.aspx" />
</siteMapNode>
<siteMapNode title="Weather" description="The Latest Weather"
url="Weather.aspx" />
</siteMapNode>
</siteMap>