Tuesday, 24 October 2017

MVC - DisplayFor - Display nothing (empty) if 0

Watch this example on YouTube




Replace
@Html.DisplayFor(modelItem => item.SomeNumber)

With

 if (item.SomeNumber != 0) {@Html.DisplayFor(modelItem => item.SomeNumber)}

No comments:

Post a Comment