asp menu

hey guys i need to develop a menu using asp control to look like this:

 menu
i can use css friendly, the hard part is the alternating colours.

please help?
JCWEBHOSTAsked:
Who is Participating?
 
royendConnect With a Mentor Commented:
I think it may help you to read this page:
http://weblogs.asp.net/dannychen/archive/2005/12/02/432190.aspx
0
 
royendCommented:
When you are looping through your menu-items, set the color by using the modulo operator:

int count = 0;
foreach(MenuItem m in Menu)
{
   if(count % 2 == 0)
    {
        //set color = blue
    }
    else
    {
        //set color = yellow
    }

   count++;
}

Open in new window

0
 
JCWEBHOSTAuthor Commented:
must i code in c#? couse i can.

just that i do not know were to start?
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
royendCommented:
Some info on the modulo operator:
It is a mathematical operator that gives you the remainder of a division.

E.g. if you divide 3 by 2, you get 1.5, or a remainder of 1 which is what the modulo operator would return.
Furthermore, if you divide 5 by 2, you get 2.5, and still the modulo function would return 1.
However, dividing 4 by 2, you get 2.0, and thus a remainder = 0, and modulo = 0.

In C#:
0 % 2 = 0
1 % 2 = 1
2 % 2 = 0
3 % 2 = 1
4 % 2 = 0
and so on...

you can of course divide by other numbers:
0 % 3 = 0
1 % 3 = 1
2 % 3 = 2
3 % 3 = 0
4 % 3 = 1
and so on....

If you are using VB you may use Mod instead of %:
0 Mod 3 = 0
0
 
royendCommented:
How do you code your menu today? Are you using ASP.NET grid or repeater, or just HTML?
0
 
JCWEBHOSTAuthor Commented:
how to set the menu background colour?

            Menu Menu = (Menu)(FindControl("Menu"));
            Menu.Items.Add(new MenuItem("Home", "", "", "#"));
            Menu.Items.Add(new MenuItem("Kids Playground Equipment", "", "", "#"));
            Menu.Items.Add(new MenuItem("Kids Entertainment", "", "", "#"));
            Menu.Items.Add(new MenuItem("Contact Us", "", "", "#"));
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.