Imagine a view bag called
ViewBag.Modes
this contains the following:
Simple
Advanced
Manual
Complete
Ho
This does the trick for me:
Controller:
public ActionResult Index()
{
var stringArray = new string[3] { "Manual", "Semi", "Auto"};
ViewBag.Collection = stringArray;
return View();
}
View:
@foreach(var str in ViewBag.Collection)
{
@Html.Raw(str);
}
@for (int i = 0; i <= 2; i++ )
{
@Html.Raw(ViewBag.Collection[i])
}
Output:
Sorry for not using your terms. I was scrachting this together from the top of my head.