Good approach for conditionally setting CSS class mvc
I know I can use HtmlHelpers which will access data repository and return the appropriate cl开发者_运维百科ass.
<a class="<%= Html.GetOnOffState(); %>"...
But what other approaches are there?
Write an entire actionlink helper so that instead of the following tag soup:
<a class="<%= Html.GetOnOffState(); %>"..
you would use:
<%= Html.ToggableActionLink("foo", "bar") %>
精彩评论