I have this bit of code in my MVC view:
<div style="">
@Html.DisplayFor(modelItem => item.ContentResourceFile.FileName)
@if (item.ContentResourceFile != null && !string.IsNullOrEmpty(item.ContentResourceFile.FileName))
{
Html.DisplayFor(modelItem => item.ContentResourceFile.FileName);
}
</div>
The first DisplayFor of FileName works it renders out in the results, but the one in the IF statement does not render out.
Can somebody explain why?