Hi all,
I have been following this thread since i have the exact same problem.Am new to .NET 2.0
and greatly appreciate any help.
Here's my situation
I have a main menu which is horizontal,and am using the CSS Control adapters(menu)
The Menu picks its items from the Web.Sitemap which is as follows
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="~/Home.aspx" title="Home" description="Home">
<siteMapNode title="VDM" url="~/VDM/Default.aspx" description="Basic Reporting Samples">
</
siteMapNode>
<
siteMapNode title="DataDashBoard" url="~/DataDashBoard/Default.aspx" description="Contains DashBoard Info">
</
siteMapNode>
<
siteMapNode title="Logout" url="~/Logout.aspx" description="Logout Page">
</
siteMapNode>
</
siteMapNode>
</
siteMap>
The Menu in the MasterPage.aspx.cs looks like this
<asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1" Orientation="Horizontal" CssSelectorClass="PrettyMenu" OnMenuItemClick="Menu1_MenuItemClick" Height="28px" Width="518px">
</asp:Menu></span>
<asp
:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false" />
I modifed the MenuAdapter.cs file in the BuildItem() to look like this
if
(IsLink(item))
{
//New code from here
//To here
if ((item.NavigateUrl.Length > 0) || item.Selectable)
{
writer.WriteBeginTag(
"a");
if (!String.IsNullOrEmpty(item.NavigateUrl))
{
writer.WriteAttribute(
"href", Page.Server.HtmlEncode(Page.ResolveUrl(item.NavigateUrl)));
//writer.WriteAttribute("href", Page.Server.HtmlEncode(menu.ResolveClientUrl(item.NavigateUrl)));
}
}
else
{
writer.WriteAttribute(
"href", Page.ClientScript.GetPostBackClientHyperlink(menu, "b" + item.ValuePath.Replace(menu.PathSeparator.ToString(), "\\"), true));
//writer.WriteAttribute("href", Page.ClientScript.GetPostBackClientHyperlink(menu, "b" + item.ValuePath.Replace(menu.PathSeparator.ToString(), "\\"), true));
}
writer.WriteAttribute(
"class", "AspNet-Menu-Link");
// writer.WriteAttribute("class", GetItemClass(menu, item));
//WebControlAdapterExtender.WriteTargetAttribute(writer, item.Target);
And also the end of the method like this
if ((item.NavigateUrl.Length > 0) || item.Selectable)
{
writer.Indent--;
writer.WriteLine();
writer.WriteEndTag(
"a");
}
}
else
{
writer.Indent--;
writer.WriteLine();
writer.WriteEndTag(
"span");
}
Despite these changes i find that OnMenuItem Click does not fire ,and postbacks do not happen
Hope someone can help.Thanks