I have written an HtmlHelper Extension to format some content based some of our styles. The helpers render the content correctly when not enclosed within an if.
However, when I am trying to wrap them in a razor if statement, nothing is rendering, I suspect it has something to do with the Razor syntax that I am not doing correctly.
Code:
<div class="notice">
@if (DataModel.UserHasExpired)
{
Html.MyCustomNotificationBox("someparameter") // My helper Should render a div
}
</div>
If I place my notificationbox outside of the if, it works fine. I have also verified that the code is dropping into the block, but none of the markup is generated in the html when I inspect it.
I've tried appening a @ like so, and ending with a colon
@Html.MyCustomNotificationBox("somparameter");
I have even tried @Html.Raw(..with the above..) which completely errors out.
Any ideas?