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.