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

<<  February 2018  >>
MoTuWeThFrSaSu
2930311234
567891011
12131415161718
19202122232425
2627281234
567891011

View posts in large calendar

RecentComments

TextBox