Created
June 18, 2011 18:38
-
-
Save samandmoore/1033385 to your computer and use it in GitHub Desktop.
script helper in app_code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@using System.Web.Mvc; | |
@helper Script(string scriptName, UrlHelper url) { | |
<script type="text/javascript" src="@url.Content("~/Scripts/" + scriptName)"></script> | |
} | |
example extracted from: | |
http://www.pluralsight-training.net/microsoft/players/PSODPlayer.aspx?author=scott-allen&name=mvc3-building-ajax&mode=live&clip=0&course=aspdotnet-mvc3-intro | |
he explains the reasoning for passing in the reference to @Url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment