Using the MenuItemClick event (C#) : Menu « Asp Control « ASP.Net

ASP.Net
1. ADO.net Database
2. Ajax
3. Asp Control
4. Collections
5. Components
6. Data Binding
7. Development
8. File Directory
9. HTML Control
10. Language Basics
11. Login Security
12. Mobile Control
13. Network
14. Page
15. Request
16. Response
17. Server
18. Session Cookie
19. Sitemap
20. Theme Style
21. User Control and Master Page
22. Validation by Control
23. Validation by Function
24. WebPart
25. WPF
26. XML
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
ASP.Net » Asp Control » Menu 
Using the MenuItemClick event (C#)


<%@ Page Language="C#" %>

<script runat="server">
   protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
   {
      Listbox1.Items.Add(e.Item.Parent.Value + " : " + e.Item.Value);
   }
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Menu Server Control</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:Menu ID="Menu1" 
                  Runat="server" 
                  DataSourceID="XmlDataSource1" 
                  OnMenuItemClick="Menu1_MenuItemClick">
            <DataBindings>
                <asp:MenuItemBinding DataMember="Item" 
                 TextField="Category"></asp:MenuItemBinding>
                <asp:MenuItemBinding DataMember="Option" 
                 TextField="Choice"></asp:MenuItemBinding>
            </DataBindings>
        </asp:Menu>
        <asp:ListBox ID="Listbox1" Runat="server">
        </asp:ListBox>
        <asp:xmldatasource ID="XmlDataSource1" runat="server" 
         datafile="Data.xml" />
    </form>
</body>
</html>

File: Data.xml

<?xml version="1.0" encoding="utf-8"?>
<Hardware>
  <Item Category="A">
    <Option Choice="A1" />
    <Option Choice="A2" />
  </Item>
  <Item Category="B">
    <Option Choice="B1" />
    <Option Choice="B2" />
    <Option Choice="B3" />
  </Item>
</Hardware>

 
Related examples in the same category
1. Using the MenuItemClick event (VB)
2. Using custom images
3. Applying divider images to dynamic items
4. A simple use of the Menu control
5. Style menu
6. Adding a hover style to static items in the menu control
7. Adding a hover style to dynamic items in the menu control
8. Forcing the menu items to use a horizontal orientation
9. Menu with CSS style
10. Menu control
11. Menu style: Orientation, StaticSubMenuIndent
12. Data Binding with Menu Control
13. Menu style
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.