Friday 8 January 2010

MVC: How to call a view stored in different folder other than the conventional.

Hi,

Welcome back!

In MVC your can return the View which will be view of the same Controller or any other existing controllers. If the view does not exist the framework search the view in Views/Shared folder.


Now, suppose you have to call the view stored in some folder MyViews under the Views folder. There is no controller with name MyViews. How to call this view then?

Here is the solution:

return View("../MyViews/TestView");

You can call this view using relative path as shown above.

Hope you have enjoy this blog.
Keep watching my blog...

No comments:

Post a Comment