2

How can i alter my views folder structure in MVC? I wanna use nested folder structure.

Views (Folder) - Content (Folder) - Admin (Folder) - Index.aspx

Controller - AdminController.cs

AdminController -> has an action Index which returns the view Index from Views->Content->Admin-Index.aspx

Is this possible and how can i do this?

1 Answer 1

3

You may take a look at areas or write a custom view engine. Scott Hanselmann blogged about a mobile view engine but you could adapt it to your needs and folder structure.

Sign up to request clarification or add additional context in comments.

7 Comments

i saw that, but its different from what i am expecting. Let me try to do something like that.. by the way.. do u have any link with some other sample same like my requirement. Let me try Scott's blog-second link
@Nimesh, check this one also: coderjournal.com/2009/05/creating-your-first-mvc-viewengine You just have to specify the ViewLocationFormats variable.
I saw one link where instead of crating custom view engine, just give the physical path.Is there any implication for this???? forums.asp.net/p/1508860/3588122.aspx#3588122
@Nimesh, yes that's also an option but if you later decide to change your folder structure it would be much easier to change it only at one place instead of modifying all your controller actions.
@Nimesh, no, I mean it's worse. You need to hardcode full paths inside your controller actions. I would recommend you creating a custom view engine for this purpose.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.