Home » Microsoft TechnologiesRSS

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" />
</asp:Menu>

 

CSS:

 .DynamicMenu
{
 display: none;
}

This can be live at www.jaindata.com

Can someone please help?

Thanks,

Swapneel Shah 

 

3 Answers Found

 

Answer 1

anyone? 

 

Answer 2

Hi,

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

simple code:

aspx:

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

aspx.cs:

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)
        {
            ChangeMenuStyle(); 
        }

        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   |   Follow us on Twitter