MVC4 Conditional attribute(s)

MVC4 beta has conditional attributes built in...

 

<div @{if(myClass !=null){<text>class="@myClass"</text>}}>Content</div>

<div class="@myClass">Content</div>

 

If @myClass is null, it just won't use the attribute at all...

Add comment

biuquote
  • Comment
  • Preview
Loading

Sponsored by

Calendar

<<  May 2018  >>
MoTuWeThFrSaSu
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

View posts in large calendar

RecentComments

TextBox