Click here to Skip to main content
13,346,487 members (69,957 online)
Click here to Skip to main content
Add your own
alternative version


87 bookmarked
Posted 5 Dec 2007

TwoColorsMenu - The fastest menu in the world

, 10 Dec 2007
Rate this:
Please Sign up or sign in to vote.
This article will demo the fastest way to create a menu for your web page with the TwoColorsMenu.



In my previous article, "Flyout - A great way to save space on your webpage", I have introduced to you a nice and free control. Today, I would like to bring here another free ASP.NET control named, TwoColorsMenu, from obout inc. As the name indicates, this is a menu made by two colors. Although it sounds simple, it is an effective, fast, and free solution for menus in your webpage. Like the Flyout component, the TwoColorsMenu is free for both personal and commercial usage.

List of features

Below are some of the highlighted features:

  • The fastest menu in the world.
  • Can work with database.
  • Compatible with Microsoft ASP.NET AJAX.
  • Content is accessible by web engine spiders.
  • Easy to use: you can have a menu with very few lines of code.

How to add the TwoColorsMenu to your page

Adding the TwoColorsMenu control to your page is very simple.

  • Copy obout_TwoColorsMenu.dll to the Bin folder of your project
  • Register TwoColorsMenu on your page:
    <%@ Register TagPrefix="tcm" Namespace="OboutInc.TwoColorsMenu" 
                 Assembly="obout_TwoColorsMenu" %>

Using the TwoColorsMenu control

Below is some sample code to start with:

<tcm:TwoColorsMenu runat="server" id="tcm1">
    <tcm:Item ID="item1" InnerHtml="Item1"/>
        <tcm:Item ParentID="item1" ID="item11" InnerHtml="Item 1 - 1"/>
        <tcm:Item ParentID="item1" ID="item12" InnerHtml="Item 1-2"/>
    <tcm:Item ID="item2" InnerHtml="Item2"/>
        <tcm:Item ParentID="item2" ID="item21" InnerHtml="Item 2-1"/>
        <tcm:Item ParentID="item2" ID="item22" InnerHtml="Item 2-2"/>

By putting the ID of parent item into the ParentID property of the child item, we can build a menu with sub-items and even with sub-sub-items.

And here is the result of our work:

Screenshot - tcm2.gif

How to change the colors for the menu?

The above image shows the default colors of the menu, those colors can be changed. There are four properties to control colors:

  • ColorBackground: The background color of an item.
  • ColorBackgroundOver: The background color of an item on mouse-over.
  • ColorFont: The font color of items.
  • ColorFontover: The font color of items on mouse-over.

If you want your menu to have other colors, like this:

Screenshot - tcm3.gif

do this:

<tcm:TwoColorsMenu runat="server" id="tcm1" 

       ColorBackground="Orange" ColorBackgroundOver="Blue" 

       ColorFont="Black" ColorFontOver="White">

How to make a vertical menu

The TwoColorsMenu menu appears, by default, in horizontal shape. But if you want to have a vertical menu, you may set the Vertical property to true.

<tcm:TwoColorsMenu runat="server" id="tcm1" Vertical="true" >

Screenshot - tcm4.gif

About the code-behind of TwoColorsMenu

Below is an excerpt of C# code to generate the TwoColorsMenu menu:

TwoColorsMenu tcm1 = new TwoColorsMenu();
tcm1.ID = "tcm1";
tcm1.StyleFolder = "styles/submenuicon";
tcm1.SubMenuText = "";
//You can easily added javascript code for menuitems

tcm1.Add(null, "brands", "Brands", 
               "javascript:alert('you clicked me');void(0);", null);
    tcm1.Add("brands", "ibm", "IBM");
    tcm1.Add("brands", "microsoft", "MICROSOFT");
    tcm1.Add("brands", "obout", "OBOUT", "", "_top");
        // The format of Add() method is Add(string ParentID,string ID,
        //                                   string InnerHtml,string Url, 
        //                                   string Target);

        tcm1.Add("obout", "treeview", "TreeView", 
                 "", "_top");
        tcm1.Add("obout", "slidemenu", "Slide Menu", 
                 "", "_top");
        tcm1.Add("obout", "calendar", "Calendar", 
                 "", "_top");
        tcm1.Add("obout", "postback", "Postback4", 
                 "", "_top");
        tcm1.Add("obout", "splitter", "Splitter", 
                 "", "_top");
        tcm1.Add("obout", "easymenu", "EasyMenu", 
                 "", "_top");
        tcm1.Add("obout", "combobox", "Combobox", 
                 "", "_top");
        tcm1.Add("obout", "editor", "HTML Editor", 
                 "", "_top");
        tcm1.Add("obout", "superbutton", "Super Button", 
                "", "_top");
        tcm1.Add("obout", "treedb", "Tree_DB", 
                 "", "_top");
        tcm1.Add("obout", "twocolorsmenu", "TwoColorsMenu", 
                 "", "_top");
tcm1.Add(null, "systems", "Systems");
    tcm1.Add("systems", "desktops", "Desktops");
    tcm1.Add("systems", "handhelds", "Handhelds");
    tcm1.Add("systems", "notebooks", "Notebooks");
    tcm1.Add("systems", "servers", "Servers");
tcm1.Add(null, "hardware", "Hardware");
    tcm1.Add("hardware", "accessories", "Accessories");
    tcm1.Add("hardware", "keyboards", "Keyboards");
    tcm1.Add("hardware", "memory", "Memory");
    tcm1.Add("hardware", "printers", "Printers");
    tcm1.Add("hardware", "videocards", "Video Cards");
tcm1.Add(null, "software", "Software");
    tcm1.Add("software", "applications", "Applications");
    tcm1.Add("software", "licensing", "Licensing");

What else can I tweak in the TwoColorsMenu?

  • You can change the font of menu items with the Font and FontParent properties.
  • You can make the menu auto position - more.
  • You can make deeper changes to the appearance of the TwoColorMenu menu with Advanced CSS - more.
  • You can change the alignment of the menu from RightToLeft - more


In this article, I have shown you how to use the TwoColorsMenu from obout inc. The TwoColorsMenu menu is easy to use, and extremely fast in rendering. You can have a ready-to-go menu for your webpage in a few minutes. I hope that you find it useful. In the Zip file, there are number of examples for you to start with. You may get the latest version of the TwoColorsMenu menu anytime from the obout Suite.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Ned Thompson
Web Developer
I am Ned Thompson, 26 years old. I am working at obout inc as web component developer. I am really good at ASP.NET and Javascript.

You may also be interested in...

Comments and Discussions

GeneralMy vote of 1 Pin
zdlik25-Apr-12 2:17
memberzdlik25-Apr-12 2:17 
GeneralMy vote of 1 Pin
duraid wadie9-Jun-11 1:07
memberduraid wadie9-Jun-11 1:07 
QuestionWhy javascript? Pin
thany.org6-Dec-07 23:14
memberthany.org6-Dec-07 23:14 
AnswerRe: Why javascript? Pin
jamief16-Dec-07 23:24
memberjamief16-Dec-07 23:24 
GeneralEffective Pin
Roberto Collina6-Dec-07 16:04
memberRoberto Collina6-Dec-07 16:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.180111.1 | Last Updated 10 Dec 2007
Article Copyright 2007 by Ned Thompson
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid