0

I created static method that will help me using js files (took the idea from him: https://stackoverflow.com/a/912989/289246).

@using Moj.Tg.Gen.UI.Common;
@section scripts {
    @JSHelper.JSBlock("/Scripts/plugins/jquery.validate.js", "Scripts/plugins/jquery.validate.min.js")
    @JSHelper.JSBlock("/Scripts/plugins/jquery.form.wizard.js", "Scripts/plugins/jquery.form.wizard.min.js")
    @JSHelper.JSBlock("/Scripts/Pledges/create.js")
}

I want this to work without writing @using Moj.Tg.Gen.UI.Common; each place I am using it. Is this possible?

Community
  • 1
  • 1
Naor
  • 23,465
  • 48
  • 152
  • 268

1 Answers1

0

In the Web.config of the Views folder I added:

<system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        ....
        ....
        <add namespace="Moj.Tg.Gen.UI.Common" /> //<-- Added this!
      </namespaces>
    </pages>
  </system.web.webPages.razor>
Naor
  • 23,465
  • 48
  • 152
  • 268