I wrote the HtmlHelper extension to format some content based on some of our styles. Helpers display content correctly if they are not enclosed inside an if.
However, when I try to wrap them in an if razor operator, nothing is displayed, I suspect this has something to do with Razor syntax, which I am not doing right.
code:
<div class="notice"> @if (DataModel.UserHasExpired) { Html.MyCustomNotificationBox("someparameter")
If I put my notification outside the if field, it works fine. I also checked that the code falls into the block, but none of the markup is generated in html when I check it.
I tried to attach @ so, and ending with a colon
@Html.MyCustomNotificationBox("somparameter");
I even tried @ Html.Raw (.. with the above ..), which doesn't work completely.
Any ideas?
source share