Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a requirement to add CMS by creating views dynamically. i have found a solution to load views from database by using VirtualPathProvider class. i have done it successfully and my next problem is we can not write actions for those dynamic views can anyone share their experience how i render my views and their content by using one action.

in simple words just need to create a common action by whom i can render my views (unlimited because of database) from database.

What I have tried:

Thanks for you guys in advance, i need q quick replies.
Posted
Updated 5-Feb-18 6:52am

1 solution

You need to not think of every page of your CMS as requiring a single action per page and thus a need for 1 generic action...instead you need to break down your CMS into the different types of pages your CMS has and have 1 action per page type.

For example, If you have a CMS that supports creating news articles, personal blogs, and say...displaying a picture gallery, you wouldn't have a single action for every gallery that gets created, rather your CMS would have 3 actions within the CMS's desired controller.

Action 1 - News
Action 2 - Blog
Action 3 - Gallery

Then form those 3 actions, you load the data to their respected models, and pass that model to their respective view accordingly.

If you have built it in such a way where each "page" gets its own unique style and formatting then your going to have to get more complex with customizability from a DB driven perspective but at its simplest form, this is how you can take a CMS with say, 100 pages and turn it into just 3 actions.

I would not suggest 1 generic action unless your CMS only supports 1 type of page (ex: a blog).

If you need to add a new page type...say, a personal file folder UI, then that would be another page type that you'd then add a 4 action to your controller for.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900