Can I have more than one Views directory in MVC?

Asked

Viewed 118 times

4

I’m transferring my project to MVC, and I was wondering if there could be more than one folder Views in the project, or if you can load a CSS outside the BundleConfig, have a static page that kind of goes bug all my pages.

  • 1

    What is the purpose of this?

  • Did any of the answers solve your question? Do you think you can accept one of them? Check out the [tour] how to do this, if you haven’t already. You would help the community by identifying what was the best solution for you. You can accept only one of them. But you can vote on any question or answer you find useful on the entire site.

2 answers

3

You can organize it any way you want. The disposition of where things are doesn’t matter. Of course it’s very easy to maintain the standard that Visual Studio already knows how to work well. No problem working with static pages.

When you return to view can do something like this:

return View("~/Views/Cadatros/Cliente.cshtml")

I put in the Github for future reference.

You can also configure routes to direct the way you want in different folders. See RazorViewEngine.

Tips to learn more.

0

You can also load the CSS outside the Bundleconfig, just insert <link href="@Url.Content("~/Content/seu-css.css")" rel="stylesheet" /> in the view you want.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.