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

<<  August 2018  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
272829303112
3456789

View posts in large calendar

RecentComments

TextBox