none
Areas in MVC RRS feed

  • Question

  • Please help ?

    I have added Areas in MVC C#  as a way to segment my application, but my styling is not working . I am also receiving $ is undefined errors on those views. 

    Am i doing something wrong?

    Thursday, June 30, 2016 9:32 PM

Answers

  • Hi Bruno678

    Thanks for your question.

    When you add Areas in an MVC project you will see that Visual Studio will create an areas folder for you with a complete set of folder for your Models, Views and Controllers. The errors you are experiencing is because you are likely missing references and dependencies from your project that are not in the new _Layout.cshtml file in the Areas section.

    You can resolve by adding the corresponding references to your new _Layout file or point the _ViewStart in the Areas to the _Layout Page in the main project.

    Eg. @Scripts.Render("~/bundles/jquery")

    You will also have to add some changes to the Web.Config file in your Areas section to include libraries that you may require.

    E.g <add namespace="********"

    If you find this thread useful please mark as answered.

    Brent /> 


    • Marked as answer by Bruno678 Thursday, June 30, 2016 9:51 PM
    Thursday, June 30, 2016 9:45 PM

All replies

  • Hi Bruno678

    Thanks for your question.

    When you add Areas in an MVC project you will see that Visual Studio will create an areas folder for you with a complete set of folder for your Models, Views and Controllers. The errors you are experiencing is because you are likely missing references and dependencies from your project that are not in the new _Layout.cshtml file in the Areas section.

    You can resolve by adding the corresponding references to your new _Layout file or point the _ViewStart in the Areas to the _Layout Page in the main project.

    Eg. @Scripts.Render("~/bundles/jquery")

    You will also have to add some changes to the Web.Config file in your Areas section to include libraries that you may require.

    E.g <add namespace="********"

    If you find this thread useful please mark as answered.

    Brent /> 


    • Marked as answer by Bruno678 Thursday, June 30, 2016 9:51 PM
    Thursday, June 30, 2016 9:45 PM
  • Thanks your advice works
    Thursday, June 30, 2016 9:51 PM