Reputation: 3466
There is a View (Action) which is only visible for Administrator. I have created this view to make it possible for administrators to create new views and actions dynamically. This view contains two text fields, first one will be the name of the newly created view, and the second is a html editor (to enable administrators add html tables, hyper links and images) which will be the content of the newly created view. How can I accoplish this? do I need to save content in the database or creating new .cshtml files in views folder? what is the best solution? thanks.
Upvotes: 0
Views: 59
Reputation: 46
I think you must save this data to database and create view with ViewName parameter. Depends from this ViewName parameter you pick proper data from database and then you can display it by eg @Html.Raw(Model.HtmlCode)
With this idea you dont have to create any additional .cshtml files. Only one action/view for edit/create and one for display.
Upvotes: 1