Posts Tagged ‘helper

Here a url helper, maybe it can interests you :

public static class UrlHelperExtension
{
public static string Image(this UrlHelper helper, string fileName)
{
return helper.Content(string.Format("~/Content/Images/{0}",fileName));
}

public static string Stylesheet(this UrlHelper helper, string fileName)
{
return helper.Content(string.Format("~/Content/Css/{0}.css",fileName));
}

public static string Javascript(this UrlHelper helper, string fileName)
{
return helper.Content(string.Format("~/Content/Scripts/{0}.js", fileName));
}
}

And here is how I use it :
For CSS :

<link rel="stylesheet" type="text/css" href="<%= Url.Stylesheet("reset") %>" media="all" />

For javascript

<script [...]


top