Sub menu - How to write click event?
-
Hi... I am having a main menu called menu1. Its sub menus are submenu1, submenu2,submenu3. I can write event for main menu click event as ASP code:
<asp:Menu ID="Menu1" runat="server" Orientation="Horizontal" ForeColor="white" BorderStyle="None"
Height="30px" onmenuitemclick="Menu1_MenuItemClick">and c# code is:
protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
{
Str = "sample";
}Now how to write click event for submenu1? any help will be appriciated.... thanks...
G.Paulraj
-
Hi... I am having a main menu called menu1. Its sub menus are submenu1, submenu2,submenu3. I can write event for main menu click event as ASP code:
<asp:Menu ID="Menu1" runat="server" Orientation="Horizontal" ForeColor="white" BorderStyle="None"
Height="30px" onmenuitemclick="Menu1_MenuItemClick">and c# code is:
protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
{
Str = "sample";
}Now how to write click event for submenu1? any help will be appriciated.... thanks...
G.Paulraj
-
Hi... I am having a main menu called menu1. Its sub menus are submenu1, submenu2,submenu3. I can write event for main menu click event as ASP code:
<asp:Menu ID="Menu1" runat="server" Orientation="Horizontal" ForeColor="white" BorderStyle="None"
Height="30px" onmenuitemclick="Menu1_MenuItemClick">and c# code is:
protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
{
Str = "sample";
}Now how to write click event for submenu1? any help will be appriciated.... thanks...
G.Paulraj
Where is your menu SubItems ? You need to first create the menu subitems inside
"Items"
tag. Then you can use the same event handler for all the items. Have a look into this article, http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.menu.menuitemclick%28VS.80%29.aspx[^] Please let me know if you need any more information. Thanks -
Where is your menu SubItems ? You need to first create the menu subitems inside
"Items"
tag. Then you can use the same event handler for all the items. Have a look into this article, http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.menu.menuitemclick%28VS.80%29.aspx[^] Please let me know if you need any more information. ThanksHi Abhijith, Thanks for your reply... My code is as follows. Please tell me how to create menu subitem on this...
<asp:Menu ID="Menu1" runat="server" Orientation="Horizontal" ForeColor="white" BorderStyle="None"
Height="30px" onmenuitemclick="Menu1_MenuItemClick">
<DynamicHoverStyle ForeColor="#000000" BackColor="Black"/>
<Items><asp:MenuItem Text="File" Value="File"> <asp:MenuItem Text="Open" Value="Open" ToolTip="Open File"></asp:MenuItem> <asp:MenuItem Text="Recent Files" Value="Recent"></asp:MenuItem> <asp:MenuItem Text="Exit" Value="Exit"></asp:MenuItem> </asp:MenuItem>
Thanks....
G.Paulraj
-
Hi Abhijith, Thanks for your reply... My code is as follows. Please tell me how to create menu subitem on this...
<asp:Menu ID="Menu1" runat="server" Orientation="Horizontal" ForeColor="white" BorderStyle="None"
Height="30px" onmenuitemclick="Menu1_MenuItemClick">
<DynamicHoverStyle ForeColor="#000000" BackColor="Black"/>
<Items><asp:MenuItem Text="File" Value="File"> <asp:MenuItem Text="Open" Value="Open" ToolTip="Open File"></asp:MenuItem> <asp:MenuItem Text="Recent Files" Value="Recent"></asp:MenuItem> <asp:MenuItem Text="Exit" Value="Exit"></asp:MenuItem> </asp:MenuItem>
Thanks....
G.Paulraj
You need to close tag and tag First. Try This :
And In Code Behind :
protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
{
Response.Write(e.Item.Text);
}Here you will find on click of every menu items / subitems , Menu Text getting write on page. Hope this will help you !
-
You need to close tag and tag First. Try This :
And In Code Behind :
protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
{
Response.Write(e.Item.Text);
}Here you will find on click of every menu items / subitems , Menu Text getting write on page. Hope this will help you !
-
Welcome :)