Hi, I have an array of ints that i display the content of in razor:
<p> @Html.DisplayFor(t => Model.Numbers[2])</p>
This displays the number at index 2 of the array.
I wonder if there's a way to display an empty value without checking if the value is 0 in the html?
I don't want to do this because I have alot of numbers and arrays to display and i can't iterate them in a foreach loop. I have huge arrays that needs to be displayed vertically next to each other. So this would be a solution:
@if(Model.Numbers[2] == 0) {<p></p> }
checking for null like this would be a very ardous task the way i have made the frontend. I'm hoping there's a way do do this in the displayfor property or something more clever, or else i have to rewrite my arrays to strings and do it in the backend.
Maybe i can do this in javascript, where i remove the content of a tag if it is 0? but that sounds like the same as checking for null with c# on each tag anyway.