Hi ahmadsubuhanl...,
When NavigateUrl is set then MenuItemClick event will not fired.
This is by design. By using the NavigateUrl property you are telling it to go to the link specified when clicked and therefore will not cause the click event to run.
The default value is an empty string (""), which indicates that this property is not set.
Refer below code.
HTML
<asp:Menu ID="Menu2" runat="server" Orientation="Horizontal" BackColor="#E3EAEB" DynamicHorizontalOffset="2"
Font-Names="Verdana" Font-Size="0.8em" ForeColor="#666666" StaticSubMenuIndent="10px" Height="47px" OnMenuItemClick="Menu2_MenuItemClick">
<DynamicHoverStyle BackColor="#666666" ForeColor="White" />
<DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<DynamicMenuStyle BackColor="#E3EAEB" />
<DynamicSelectedStyle BackColor="#1C5E55" />
<Items>
<asp:MenuItem Text="File" Value="File" NavigateUrl="~/form/editabsengroup.aspx">
<asp:MenuItem Text="Master" Value="Master">
<asp:MenuItem Text="Invetory" Value="Inventory" NavigateUrl="~/form/form1.aspx"></asp:MenuItem>
<asp:MenuItem Text="Stock" Value="Stock" NavigateUrl="~/form/form2.aspx"></asp:MenuItem>
<asp:MenuItem Text="Warehouse" Value="Warehouse" NavigateUrl="~/form/form3.aspx"></asp:MenuItem>
</asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem Text="Proses" Value="New Item"></asp:MenuItem>
<asp:MenuItem Text="Tools" Value="Tools"></asp:MenuItem>
</Items>
<StaticHoverStyle BackColor="#666666" ForeColor="White" />
<StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<StaticSelectedStyle BackColor="#1C5E55" />
</asp:Menu>
Code
C#
protected void Menu2_MenuItemClick(object sender, MenuEventArgs e)
{
MenuItem selectedItem = (sender as Menu).SelectedItem;
ClientScript.RegisterStartupScript(this.GetType(), "message", "alert('" + selectedItem.Text + "')", true);
}
VB.Net
Protected Sub Menu2_MenuItemClick(sender As Object, e As MenuEventArgs) Handles Menu2.MenuItemClick
Dim selectedItem As MenuItem = TryCast(sender, Menu).SelectedItem
ClientScript.RegisterStartupScript(Me.GetType(), "message", "alert('" & selectedItem.Text & "')", True)
End Sub
Screenshot