Home » Microsoft Technologies

Menu Control expansion weired issue.

Menu control expands on load (vertically, 100%) and then contracts to its horizontal position.

The code I am using-

ASPX page:

<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="False" IncludeStyleBlock="False" Orientation="Horizontal" DataSourceID="SiteMapDataSource1">
                    <DynamicMenuStyle CssClass="DynamicMenu" />



 display: none;

This can be live at www.jaindata.com

Can someone please help?


Swapneel Shah 


3 Answers Found


Answer 1



Answer 2


According to your description, I think we can use updatepanel to control the menu  display style with no refreshing. 

simple code:


<form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        <asp:Timer ID="Timer1" runat="server" Interval="5000" OnTick="Timer1_Tick">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <asp:AsyncPostBackTrigger ControlID="Timer1" />
                <asp:Menu ID="NavigationMenu" runat="server" Orientation="Vertical" ViewStateMode="Disabled"
                    DataSourceID="SiteMapDataSource1" StaticDisplayLevels="5">
                <asp:SiteMapDataSource ID="SiteMapDataSource1" ShowStartingNode="false" runat="server"
                    SiteMapProvider="MySiteMapProvider" />


protected void Page_Load(object sender, EventArgs e)
            this.NavigationMenu.Orientation = Orientation.Vertical;
            this.NavigationMenu.StaticDisplayLevels = 10;

        protected void Button2_Click(object sender, EventArgs e)

        protected void Timer1_Tick(object sender, EventArgs e)

        private void ChangeMenuStyle()
            this.NavigationMenu.Orientation = Orientation.Horizontal;
            this.NavigationMenu.StaticDisplayLevels = 1;
            this.Timer1.Enabled = false;

When page loaded, the menu control  display style will change after 5 seconds.

Hopes can help you. 


Answer 3

Menu being displayed vertically and then setting it to come up horizontally (with a postback), does not make any sense to me! I hoped there was a property to set to get the desired result.

Anyway, Thanks for your reply Zizhuoye Chen!




I have a an asp:Menu with a datasource and the page is being accessed by https. If I hover over one of the menu items that has a subitem I get this popup.

Here is my code,

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="UI_Common_Test" %>

<!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">
    <form id="form1" runat="server">
        <asp:Menu ID="Menu1" runat="server" DataSourceID="dsSiteMap" Orientation="Vertical"
                <asp:MenuItemBinding DataMember="SiteMapNode" TextField="Title" />
        <asp:SiteMapDataSource ID="dsSiteMap" runat="server" SiteMapProvider="Public" />


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class UI_Common_Test : BasePage
    protected void Page_Load(object sender, EventArgs e)


    <siteMap defaultProvider="Public">
        <add name="Public" type="System.Web.XmlSiteMapProvider" siteMapFile="~/Navigation/Public.sitemap"/>

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
  <siteMapNode url="~/validpage.aspx" title="Home" >
    <siteMapNode url="~/validpage2.aspx" title="Page2" />
    <siteMapNode url="~/validpage3.aspx" title="Page3">
      <siteMapNode url="~/validpage4" title="Page4" />


How to recognize if a mouse click in a TreeView control pointed on the expansion/collase marks, instead of normal TreeNodes ? TreeNodeMouseClickEventArgs doesn't seem to have such option. In my program, a left mouse click triggers some other actions. My goal is only to expand or collase the TreeView if (+/-) marks are selected.

Please advice, thanks


Hello all,

I am experiencing a weird issue with my menu control on a website I just launched.  Basically it seems like the top and bottom padding for the control is like 400 pixels on certain pages.  This does not happen on IE6, IE8, Firefox 3.6, or chrome.  Only IE7 (also IE8 compatibility mode).  The other weird thing is that it happens 90% of the time and not 100%, so I can't get full consistency.  Here is an image of what it should look like versus what the issue is.

http://i51.tinypic.com/2zqsy3b.png good menu

http://i53.tinypic.com/2q9gia1.png bad menu

What I have done so far is remove skiplinktext and also tried to remove the 4px padding I had, neither helped.  Any ideas? Thanks!!


menu nav = home page > studio info > Registration > Register now


Ok, everyone knows that the z-index is messed up in IE8 and that requires patches or workarounds...

What I can't seem to find a solution to is the white background on the DynamicMenu parts of a Menu control.  Setting the background color to transparent or not setting it all doesn't seem to have any effect.  This is only a problem in IE8, Firefox 3.6.8 renders the dynamic menus without the white background.


Hi All,

I am trying to create the following HTML menu in ASP.NET 4.0  using asp.net menu control but not succeeded yet. I set the RenderMode="List" in Menu control but it creates different view:

HTML ( Similar menu I want in ASP.NET 4.0 using Menu control)


<ul id="mainNavMenu">
        <li><a href="">Main Menu Item</a>
            <li><a href="">Sub Nav Menu Item</a></li>
            <li><a href="">Sub Nav Menu Item</a></li>
            <li><a href="">Sub Nav Menu Item</a></li>
            <li><a href="">Sub Nav Menu Item</a></li>

<ul id="mainNavMenu">

        <li class="mainMenu">

                  <a href="">Main Menu Item</a>

                   <ul class="subMenu">

                          <li><a href="">Sub Nav Menu Item</a></li>

                           <li><a href="">Sub Nav Menu Item</a></li>

                           <li><a href="">Sub Nav Menu Item</a></li>





css Used in this


#mainNavMenu li.mainMenu {



border-left:1px solid #D6C7B4;

padding:5px 8px 5px 8px;





/* padding & noLeft class adjusts the padding as borders are added & removed */

#mainNavMenu li.noLeft { border-left:1px solid #FFF;}

#mainNavMenu a, #mainNavMenu a:active, #mainNavMenu a:visited{




#mainNavMenu li.on{ 

border:1px solid #ECB00E; 

padding:4px 7px 4px 8px;


#mainNavMenu ul.subMenu {







#mainNavMenu  ul.mainMenu li a:hover{

border:1px solid #ECB00E;


#mainNavMenu .on ul.subMenu {

border:1px solid #ECB00E;



width: 200px;



#mainNavMenu ul.subMenu li {

border-bottom:1px solid #D6c7B4;


#mainNavMenu ul.subMenu li a {

padding:5px 10px 5px 10px;

display: block;


#mainNavMenu ul.subMenu li a:hover {

background: #e5e5e5;



My Menu control COde


    <asp:Menu ID="mainNavMenu" runat="server" Orientation="horizontal"     DataSourceID="SiteMapDataSource1" 

    StaticEnableDefaultPopOutImage="false"  RenderingMode="List" ClientIDMode="Static">

  <StaticMenuStyle CssClass="mainMenu" />

    <DynamicMenuStyle CssClass="subMenu" />


          <asp:menuitemstyle  HorizontalPadding="8" VerticalPadding="4"/>   




        <asp:MenuItemBinding DataMember="SiteMapNode" TextField="Title" ValueField="Title"  NavigateUrl="Url" />





Please some one can help me to create similar Menu as  spefified in HTML. I required in urgently.

Thanks in Advance



I have a menu with around 20 forms.

each menuitem represents a window that needs to be displayed when clicked.

i am using the click handler to capture the click event.

my problem here is i dont want to use cases and manually hardcode each instance of the window to show on click.

is there a better way to handle the forms.

can we dynamically create window instances from a string containing the window class.


like ---


form2... form10

case1: form1 f = new form1();


etc.. etc..

any help? this cases are bad .



I am doing a rework on one of my sites and I am attempting to use the asp:menu control.

I am using images in the static and dynamic menus.  Hard coded at this point.

On my local machine it works fine but when I upload to the server, the image on the dynamci menus do not appear.

Instead I just get white space where the images should be.


Here is the code:













<asp:MenuItemImageUrl="~/Demos/Buttons_100px_Wide/Home.jpg"ToolTip="No Rules Riders Main Home Page">


<asp:MenuItemImageUrl="~/Demos/Buttons_100px_Wide/AboutUs.jpg"ToolTip="About No Rules Riders"></asp:MenuItem>


<asp:MenuItemImageUrl="~/Demos/Buttons_100px_Wide/History.jpg"ToolTip="The history of No Rules Riders"></asp:MenuItem>


<asp:MenuItemImageUrl="~/Demos/Buttons_100px_Wide/Contact.jpg"ToolTip="Contact the Founder of No Rules Riders - Mike Kemmeries"></asp:MenuItem>


<asp:MenuItemImageUrl="~/Demos/Buttons_100px_Wide/Advisors.jpg"ToolTip="Contact a local No Rules Riders Advisor in your region"></asp:MenuItem>




<asp:MenuItemImageUrl="~/Demos/Buttons_100px_Wide/Chapter.jpg"ToolTip="All the functions within the active Chapter">


<asp:MenuItemImageUrl="~/Demos/Buttons_100px_Wide/ChapterHome.jpg"ToolTip="Show the Chapter home page"></asp:MenuItem>


<asp:MenuItemImageUrl="~/Demos/Buttons_100px_Wide/Events.jpg"ToolTip="Show scheduled events for the active Chapter"></asp:MenuItem>


<asp:MenuItemImageUrl="~/Demos/Buttons_100px_Wide/Links.jpg"ToolTip="Show links for the active Chapter"></asp:MenuItem>


<asp:MenuItemImageUrl="~/Demos/Buttons_100px_Wide/Mail.jpg"ToolTip="Send e-mail to all subscribers of Chapter Mail"></asp:MenuItem>









Page links:




I am using asp.net menu control. In window application we assign shortcut key through '&' sign for accessing menu item but in asp.net this is not working and there is not any property for access key for menu items. please give me any suggestion.



Nitin Munjani

I am using asp.net menu control. In window application we assign shortcut key through '&' sign for accessing menu item but in asp.net this is not working and there is not any property for access key for menu items. please give me any suggestion.


I am using asp.net menu control. In window application we assign shortcut key through '&' sign for accessing menu item but in asp.net this is not working and there is not any property like access key for menu items. please give me any suggestion.



Nitin Munjani



I am using the asp:Menu control. I have the following code. However, when I hover over the Menu Item A, its sub-menus disappear. The sub-menus are visible on page load. But as soon as I hover over the item, it disappears. Any ideas why??  




 <asp:MenuItemText="X"NavigateUrl="x.aspx" ToolTip="X"></asp:MenuItem>

 <asp:MenuItemText="Y" ToolTip="Y" Target="_blank"></asp:MenuItem>  






Please help!



Here is my query

select(replace([height],'1','10')),heightstatus, [height]=(casewhen heightstatus=1thenreplace(Convert(varchar,[height]),'1','10')else [height]end)

When i execute this query for a record which has heightstatus true (1) , it clearly executes the then part. but i am getting 5.1 instead of 5.10. But if i place the same code which exists in then part to else part also, it gives 5.10. But if i remove the code from then part and just put [height], it again stop working. I mean it give 5.1.

Can anyone guess what is happening?


I am trying to search for any string that contains ";" in a column of a table which results in some weired resultset. Its not only returning me the results that has ";" but also returns those rows which doesn't contain any ";" but contains "'".

Following is my query

select * from fields where Comment like '%;%'

and returned results is

Moody's Corp, Lowe's Companies, Inc., L'Oreal SA

instead of no records, I know in this table there are no rows that contains ";".

Any idea?



I am got a following weired error from my sql clusters

"Severity: 16 Error:-2146892976, OS: -2146892976 [Microsoft][SQL Native Client]SQL Network Interfaces: The system detected a possible attempt to compromise security.  Please ensure that you can contact the server that authenticated you"

Can anyone explain what is going on here?

Thanks, Sengwa




I've created a DataGrid and supplied it with data. The problem is when I scroll over the table many times, the Scrollbar is expanding.

Could any one help in this?

Many Thanks

Eng. Belal



i would appreciate recieveing a sample for creating candle stick chart.

in addition, my chart area inside the control is limited. how do i set it to fit into the whole control?


I cannot seem to be able to run any deployed VXML that contains a grammar with a <tag> element. At first, I thought I was doing something wrong in my code, but when I attempted to run the sample code available at https://studio.tellme.com/library2/code/ex-102/index.vxml, I received the same error:

[11/13/09 08:24:06] LOGIN
[11/13/09 08:24:06] ERROR "invalid rule expansion in tag (line: %d col: %d) (line: 81 col: 24); parsing failed; " at <grammar> tag (line 74, column 6 in file http://web.me.com/edibiase/15492/dept.vxml)
[11/13/09 08:24:06] ERROR "file load failed" at <block> tag (line 8, column 7 in file <studio resource>)

Am I, in fact, doing something wrong, or is the Tellme Studio system having difficulties at the moment?



I'm trying to relate "Workflow expansion task" entries in the AsyncOperationBase table back to a source workflow, although the WorkflowActivationId is NULL for these rows.

I can get to the source object via the RegardingObjectIdName, but there must be a way to link back to the source workflow which generated these entries?

Can I possibly use the Data column? Does this contain info about the source workflow? This appears to be base 64 encoded, but I have had no luck in trying to decode it, just getting symbols and foreign chars.


Any help appreciated,






I have added Two Way Synonyms in FAST Search Keywords option in Site Settings. If I type the synonym alone, it works but if I type it with some other keyword, the search results in no hits whereas with the Same Keyword if i give the Main Keyword instead of its synonym, the search is successful. I understand that for this we need to do Query Side Expansion of Synonyms. I also tried to Set a Resubmit Flag to AddSynonymsAutomatically but this also failed. Can u pls suggest a way for this?


I get this error when, as it says, when I am tying to do a

query = from blah in context.Expand("sometype") select new {A= blah.x}

I need to do an explicit projection because some of the columns contain husge amounts of data which I do not want to be sent acorss the wire.

I think I need to Expand becuase I need to populate the entities at the end of the forign key relationships.

Am I stuck? Is WCF Data Services (3.5SP1 latest patch) not up to the job?

Or is there another solution?




<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure