MenuItem selected value
-
Hi
<asp:Menu ID="Menu1" runat="server" OnMenuItemClick="Menu1_MenuItemClick" Orientation="Horizontal"> <Items> <asp:MenuItem Text="Main Menu" Value="Test"> <asp:MenuItem Text="Second" Value="secondform.aspx"></asp:MenuItem> <asp:MenuItem Text="Third" Value="thirdform.aspx"></asp:MenuItem> </asp:MenuItem> </Items> </asp:Menu> <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder>
and my Menu1_MenuItemClick event is:protected void Menu1_MenuItemClick(object sender, MenuEventArgs e) { Server.Transfer(((System.Web.UI.WebControls.Menu)(sender)).SelectedValue); }
When I click the menu item, URL show the previous SelectedValue. Not the page is currently shown. Any help would be appreciated. Thanks Muthu -
Hi
<asp:Menu ID="Menu1" runat="server" OnMenuItemClick="Menu1_MenuItemClick" Orientation="Horizontal"> <Items> <asp:MenuItem Text="Main Menu" Value="Test"> <asp:MenuItem Text="Second" Value="secondform.aspx"></asp:MenuItem> <asp:MenuItem Text="Third" Value="thirdform.aspx"></asp:MenuItem> </asp:MenuItem> </Items> </asp:Menu> <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder>
and my Menu1_MenuItemClick event is:protected void Menu1_MenuItemClick(object sender, MenuEventArgs e) { Server.Transfer(((System.Web.UI.WebControls.Menu)(sender)).SelectedValue); }
When I click the menu item, URL show the previous SelectedValue. Not the page is currently shown. Any help would be appreciated. Thanks MuthuHi kmuthuk, you need to set the navigateUrl property for each menu items, then it will work :)
Chatura Dilan