Menu for ASP.NET Web Forms
Creating a Drop-Down Menu
Task-Based Help > Creating a Drop-Down Menu

This topic illustrates the creation of a drop-down menu using Design view, Source view, and code. To add a drop-down menu, all you have to do is add one (or more) C1MenuItem as a child of a top-level C1MenuItem.This topic assumes that you have completed Adding a Top-Level Item to a Menu.

In Design View

Complete the following steps:

  1. Click the smart tag to open the C1Menu Tasks menu. Select Edit Menu.
  2. The C1Menu Designer Form dialog box opens.
  3. Select the menu item you wish to add the submenu to.
  4. Click the Add Child Item drop-down arrow and select Link Item from the list to add a child item to the selected menu item.

    C1MenuDesignerForm

  5. Click OK to close the C1Menu Design Form dialog box.

In Source View

Add the following markup between the <cc1:C1MenuItem> tags of the item you wish to add the submenu to:

To write code in Source View

<Nodes>
<cc1:C1MenuItem ID="Node1" runat="server" Text="LinkItem1">

</cc1:C1MenuItem>

<Nodes>

In Code View

Complete the following steps:

  1. Import the following namespace into your project:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Imports C1.Web.Wijmo.Controls.C1Menu
    

    To write code in C#

    C#
    Copy Code
    using C1.Web.Wijmo.Controls.C1Menu;
    
  2. Add the following code to the Page_Load event:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    ' Create first node and add it to the C1Menu.
    Dim C1MenuItem1 As New C1MenuItem()
    C1MenuItem1.Text = "LinkItem1"
    C1Menu1.Items.Add(C1MenuItem1)             
    ' Create the child node and add it to C1MenuItem1
    Dim C1MenuItem2 As New C1MenuItem()
    C1MenuItem1.Text = "LinkItem1"
    C1MenuItem1.Items.Add(C1MenuItem2)
    

    To write code in C#

    C#
    Copy Code
    // Create first node and add it to the C1Menu.
    C1MenuItem C1MenuItem1 = new C1MenuItem();
    C1MenuItem1.Text = "LinkItem1";
    C1Menu1.Items.Add(C1MenuItem1);
    // Create the child node and add it to C1MenuItem1
    C1MenuItem C1MenuItem2 = new C1MenuItem();
    C1MenuItem2.Text = "LinkItem1";
    C1MenuItem1.Items.Add(C1MenuItem2);
    
  3. Run the program.

C1MenuThis topic illustrates the following:

Creating a submenu is as easy as adding a child C1MenuItem to a parent C1MenuItem.

SubMenu