Okay. I am pretty new to these adapters. In fact I am just plain new. I am trying to use the menu adapter and a sitemap to create a horizontal menu that will show the starting node of the sitemap "HOME" and the second tier as well. So it looks like
Home > Projects > Solutions >
Also, the OnClick even doesn't seem to fire now that I am using a datasource rather than Item tags.
Here's the code I am using:
<%@ Page Language="VB" %>
<script runat="server">
Public Sub OnClick(ByVal sender As Object, ByVal e As MenuEventArgs)
MessageLabel.Text = "You selected " & e.Item.Text & "."
e.Item.Selected = True
End Sub
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<link href="~/WalkThru/SimpleMenu.css" rel="stylesheet" type="text/css" />
<link id="AdaptersInvariantImportCSS" runat="server" href="~/CSS/Import.css" rel="stylesheet"
type="text/css" />
<!--[if lt IE 7]>
<link runat="server" rel="stylesheet" href="~/CSS/BrowserSpecific/IEMenu6.css" type="text/css" id="IEMenu6CSS" />
<![endif]-->
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Menu ID="EntertainmentMenu" runat="server" CssSelectorClass="SimpleEntertainmentMenu"
DataSourceID="SiteMapDataSource1" OnMenuItemClick="OnClick"
Orientation="Horizontal" >
</asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false"/>
</div>
<div id="EntertainmentMessage">
<asp:Label ID="MessageLabel" runat="server"></asp:Label>
</div>
</form>
</body>
</html>
As you may notice, this is basically the SimpleMenu example with some minor changes. I removed the <item> tags in lieu of using a site map for my datasource. However, the OnMenuItemClick event doesn't seem to fire when you click on one of the items. I don't even know where to begin looking for the problem. Any help would be greatly appreciated.
I only created a very basic sitemap as follows:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="" title="Home" description="">
<siteMapNode url="" title="Projects" description="Projects" >
<siteMapNode url="" title="Projects1" description="" />
<siteMapNode url="" title="Projects2" description="" />
</siteMapNode>
<siteMapNode url="" title="Solutions" description="" >
<siteMapNode url="" title="Solutions1" description="" />
<siteMapNode url="" title="Solutions2" description="" />
</siteMapNode>
</siteMapNode>
</siteMap>
Unfortunately it doesn't seem like the StaticDisplayLevels has any effect on the menu. When ShowStartingNode is set to true I only see Home, when it is false I see Projects > Solutions >. I tried using the StartingNodeOffset but that didn't work, I also tried using the StaticDisplayLevels too. Neither worked.
Thanks.
Simple minds think alike. Great minds come up with something different.