.net MVC Areas and subfolders

I am using Areas in my project but I would like to organise my views within these areas into sub folders.

For example, I have an area called Members which contains a Controller called Settings and another Controller called MemberCategory. MemberCategory is in effect a subfolder of Settings.

I would like when I access the Member Category view for my url to resolve to Members/Settings/MemberCategory

At present it resolves to Members/MemberCategory

Is it possible to nest the views into subfolders and change the controller to point to

return View("Members/Settings/MemberCategory");

Or do this need to done with routing?

Any examples would be appreciated.

Answers


I have resolved this problem with Routes and not nesting the views into subfolders.

In my Area Registration file I have added the following above the default route:

    context.MapRoute(
        "MemberCategory",
        "Members/Settings/MemberCategory",
        new { controller = "MemberCategory", action = "Index" }
    );

    context.MapRoute(
        "MemberCategoryAction",
        "Members/Settings/MemberCategory/{action}/{id}",
        new { controller = "MemberCategory", action = "Index", id = UrlParameter.Optional }
    );

Not sure if this is the most elegant way of doing this but it works in my case.


Need Your Help

for loop optimization

java coding-style optimization

List<String> flowers = new ArrayList<String>();

Unable to loop through collection - backbone

javascript backbone.js

Below is my json structure and after collection fetch i'm unable to loop through it.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.