I’ve tried
<%: Html.DisplayFor(m => m.Overall) %>
<%: Model.Overall %>
and neither work and may only ideas right now would be to make if statments on the view itself that if it was null not to display but I have over 200 values so time consuming and wasteful, my other idea was to do the same but in jquery document.ready the if statements.
does anybody have any simple ideas or css solutions which would prevent a mass of white space.
thx
If you are using MVC 3 using display templates you can create a loop over the properties. So similar to another answer, create a display template for NotEmptyProperties.ascx and in your page call:
And then in the display template:
The
Evalmethod on theViewDataDictionarywill let you null check the properties in your loop and only display the ones that aren’t null.