I am trying to create an asp.net MVC 3 Razor helper under app_code folder like this:
@using System.Web.Mvc;
@helper Script(string scriptName, System.Web.Mvc.HtmlHelper url){
<script src="@url.Content"~/Scripts/" + scriptName)" type="text/javascript"></script>
}
but I am getting error that:
system.web.mvc.htmlhelper does not contain a definition of content
at following line:
<script src="@url.Content"~/Scripts/" + scriptName)" type="text/javascript"></script>
The error is surprisingly helpful – HtmlHelper does not contains method Content(), the UrlHelper does. Try this :