I am rather new to the MVC 3 environment, and I need help.
I am trying to setup a MVC environment in a portal type of scenerio. So I setup a base project for MVC 3 in VS 2010. The following is the folder structure:
Common
Controllers
Resources
Views
Project1
Controllers
Views
Project2
Controllers
Views
Question 1: how do I bind a specific Controller in /Project1/Controllers to Project1/Views?
Question 2: How do I set up the Project1/Views folder? I know the default Views folder has a web.config file, and the MVC is setup to look in this folder by default. How do I change this behavior, so I can include the Project1/Views.
please read the mvc docs. view are not servered and not accessed by iis. in mvc the routemap (global.asax) turns a url into an controler action call. only a controler will load a view and it can use any path its wants to find a view (its work but you can
define your own view paths)
Thank you for taking the time to comment. As you mentioned, the controller will load a view. I need to be able to tell the controller to look in other folder than the default /Views folder.
You mentioned to read the mvc docs. I have been looking around, and I have not found that information. Can you provide a link.
eherrera
Member
5 Points
4 Posts
How to bind a Controller to a View
Feb 29, 2012 05:24 PM|LINK
Hi
2 Posts
<div class="comment-right-col">Hi All,
I am rather new to the MVC 3 environment, and I need help.
I am trying to setup a MVC environment in a portal type of scenerio. So I setup a base project for MVC 3 in VS 2010. The following is the folder structure:
Question 1: how do I bind a specific Controller in /Project1/Controllers to Project1/Views?
Question 2: How do I set up the Project1/Views folder? I know the default Views folder has a web.config file, and the MVC is setup to look in this folder by default. How do I change this behavior, so I can include the Project1/Views.
Thank you,
E.
</div>views
bruce (sqlwo...
All-Star
36822 Points
5441 Posts
Re: How to bind a Controller to a View
Feb 29, 2012 06:37 PM|LINK
please read the mvc docs. view are not servered and not accessed by iis. in mvc the routemap (global.asax) turns a url into an controler action call. only a controler will load a view and it can use any path its wants to find a view (its work but you can define your own view paths)
eherrera
Member
5 Points
4 Posts
Re: How to bind a Controller to a View
Feb 29, 2012 07:13 PM|LINK
Bruce,
Thank you for taking the time to comment. As you mentioned, the controller will load a view. I need to be able to tell the controller to look in other folder than the default /Views folder.
You mentioned to read the mvc docs. I have been looking around, and I have not found that information. Can you provide a link.
Thank you,
E.
ryanw51
Contributor
2363 Points
511 Posts
Re: How to bind a Controller to a View
Feb 29, 2012 07:47 PM|LINK
Take a look at MVC areas. http://msdn.microsoft.com/en-us/library/ee671793.aspx