I'm trying to do a very simple Html helper in Asp.net MVC 5:
@helper GetMyTextArea()
{
@Html.TextArea("myText")
}
Then i try to include it in my view: (the helper is in a file called MyHelp.cshtml
, located in the App_Code
Folder)
@MyHelp.GetMyTextArea()
If i render my view now, i get following exception:
System.NullReferenceException: System.Web.WebPages.HelperPage.Html.get returned null.
Anyone know this issue? I think i can work around it with a partial view
but this shouldn't be a problem with a html helper.