I would like different options in my SelectList to have different colors (red/green) depending if they are active or not.
At the moment I do the following in the Controller:
ViewData["fooID"] = new SelectList(_context.foo, "fooID", "fooName", foo.fooID);
And the following on my View:
<select asp-for="fooID" class="form-control" asp-items="ViewBag.fooID"></select>
I would like to use something like:
class="@(foo.fooActive ? "green" : "red")"
But I guess I must use a different approach than ViewData?