Click here to Skip to main content
14,774,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am populating a menu control from database in my page load event. In my page load event I am using a JavaScript to hide the menu. And in one image link mouse hover I am calling one more JavaScript function to make it visible.

My problem is my menu is not hiding automatically in mouse out.


My Menu:
<asp:Menu ID="mnuProject" runat="server"
        onmenuitemclick="mnuProject_MenuItemClick" Style="z-index: 200; left: 1200px;
           position: absolute; top: 97px"

                    DynamicHorizontalOffset="2"
                    MaximumDynamicDisplayLevels="6";
                    StaticSubMenuIndent="10px"

                    Height="0px"
                    StaticMenuItemStyle-CssClass="menuItemA"
                    DynamicMenuItemStyle-CssClass="subMenuItemA"
                    DynamicHoverStyle-CssClass="subMenuItem_selectedA">

CSS:
.menuItemA
{
    font-family: Arial;
    font-size: small;
    color: White;
    background-attachment: scroll;
    background-image:url('../Images/small-bar.png');
}

.subMenuItemA
{
    font-family: Arial;
    font-size: small;
    color: Navy;
    background-attachment: scroll;
    background-image: url("../Images/Menu subitem background silver.png");
    padding-top: 5px;
    padding-bottom:5px;
}
.subMenuItem_selectedA
{
    font-family: Arial;
    font-size: small;
    color: Blue;
    padding-top: 5px;
}

Load event code:
 mnuProject.Items.Clear();
        DataSet ds = master.SelectProjectDetails();
        Menu menu = new Menu();
        foreach (DataRow parentItem in ds.Tables[0].Rows)
        {
            MenuItem categoryItem = new MenuItem((string)parentItem["ProjectName"]);
            mnuProject.Items.Add(categoryItem);
        } 

mnuProject.Attributes.Add("style", "visibility:hidden;z-index: 200; left: 1200px; position: absolute; top: 97px");


To make it visible:
In some image mousehover :

function showProject() {
    document.getElementById('mnuProject').style.visibility = 'visible';
}




Please solve my problem guys.
Posted
Updated 13-Jul-11 20:24pm
v2

1 solution

First check whether Javascript is disabled on your browser or not. Code seems OK with me. I did that a long time back, still, its fine.
   
Comments
nilakashnil 14-Jul-11 2:27am
   
First check whether Javascript is disabled on your browser or not

Hi, I am a beginner in asp.net. Please explain this. I have tried java script on mouseout of maenu but not working.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900