razor - Conditional Formatting with ASP.NET MVC -



razor - Conditional Formatting with ASP.NET MVC -

i have asp.net mvc app uses razor in views. in view, have following:

<table style="width:100%;"> ... </table>

i want say, if (items.count == 0), background color of table should orange. however, if (items.count > 0), want background color of table gray. how do razor?

thank you!

just give 1 more option, can set color @ page begining.

@{ var color = items.any() ? "#ccc" : "#ff0"; }

and @ table tag

<table style="color:@color"></table>

asp.net-mvc razor

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -