Reputation: 61
I'm working with a project that has as ASP menu (), which I can't get to close. All I want it to do is to collapse when the mouse is not hovering it. Is there a setting or something to fix this? Maybe a simple problem but I've searched everywhere with no luck.
I can expand the menu just fine, and when I move to a different node it switches to that just. The problem is when I move the mouse outside the entire menu, it stays open. Shouldn't there be some simple setting for this? Do I really have to jump through several hoops of javascript and events to fix this?
Upvotes: 1
Views: 179
Reputation: 62260
By default, menu should collapse as soon as cursor is out. Strip out all css and test it with simple code.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MenuTest.aspx.cs" Inherits="WebApplication2012.MenuTest" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:Menu runat="server" DataSourceID="MenuDataSource"></asp:Menu>
<asp:SiteMapDataSource ID="MenuDataSource" runat="server" ShowStartingNode="false"
SiteMapProvider="XmlSiteMapProvider" />
</form>
</body>
</html>
// MenuTest.sitemap
<?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="Monday" title="One" description="One" >
<siteMapNode url="Monday - One" title="Monday - One" description="Monday - One" />
<siteMapNode url="Monday - Two" title="Monday - Two" description="Monday - Two" />
<siteMapNode url="Monday - Three" title="Monday - Three" description="Monday - Three" />
</siteMapNode>
<siteMapNode url="Tuesday" title="Tuesday" description="Tuesday" />
</siteMapNode>
</siteMap>
// web.config
<system.web>
...
<siteMap defaultProvider="XmlSiteMapProvider">
<providers>
<add name="XmlSiteMapProvider" type="System.Web.XmlSiteMapProvider" siteMapFile="~/MenuTest.sitemap" />
</providers>
</siteMap>
</system.web>
Upvotes: 0