Hello.
I am working in asp.net in razor mvc.
I am trying to give a class name to an html tag, the class name is stored in an array as a string.
I am looping through the array with a foreach and i does work, i get the class, but the problem is that i have 5 elements in my array and i only need as many class names as many html tags i have.
Below i will show you what i mean.
The number {0} and {1} are for something else.
string[] liclasses = { "fc-orange", "fc-sky", "fc-red", "fc-green", "fc-per" };
foreach (string lic in liclasses)
{
html += string.Format("<li class=\"{2}\"><a href=\"{0}\" ><span>{1}</span> </a></li>"
, target, lbl, lic);
}
As i said this works but when i create a menu item in the ADMIN page it makes 5 instances of the menu item i will show you down how it looks.(We have our own CMS and we create everything in the admin page and they are added automaticly in the code).
Menu items--> Home About About About About About Contact
What I have tried:
The only thing i have tried is the foreach loop.
I am stuck here.