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!



<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure