开发者

Good approach for conditionally setting CSS class mvc

开发者 https://www.devze.com 2023-03-20 10:10 出处:网络
I know I can use HtmlHelpers which will access data repository and return the appropriate cl开发者_运维百科ass.

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") %>
0

精彩评论

暂无评论...
验证码 换一张
取 消