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
Post a Comment