asp.net-mvc-3client-dependency

CleintDependency path with no Layout specified


I have an ASP.NET MVC 3 site that makes use of a ClientDependency framework for dep. resolution (CSS/JS).

My base path's are defined in /Shared/_Layout.cshtml like this:

@MvcHtmlString.Create(Html.RenderCssHere(new List<IClientDependencyPath> {
      new BasicPath("Base", "~/Content/themes/base"),
      new BasicPath("Content", "~/Content")
    }))

I want to have one page without a standard layout. I force it by calling

@{
    Layout = null;

    Html.RequiresCss("FileUpload/fileUpload.css", "Content", 20);
}

However, I can no longer request a dep. like shown above, since "Content" path isn't defined.

I am rather new to ClientDependency framework, so which is the best way for me to get my dependencies in a non-layout view?


Solution

  • I need to have the Path declared somewhere in the View, as well as the RenderCss/JsHere element, so if I don't use a shared layout, I had to re-declare it in my custom page all together.