I saw Scott Guthrie's post about helper methods via his blog.
Specifically this:
I see the bunch of RC version of MVC 3 posts about the lack of helper methods... I see the syntactical support for it (@helper
) gets highlighted, but I have this in /Views/Helpers/SomeHelper.cshtml
(defined as a partial view):
@helper SomeHelper(string text)
{
if (text != null)
{
<text>
@text
</text>
}
else
{
<text>
Unknown
</text>
}
}
I use it this way:
<div>
Helper with Text:
@SomeHelper("This is not null text.")
</div>
But I get SomeHelper is not defined.... so where did I mess this up? Is there something I need to do to register these views as helpers?
Thanks.