0

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.

1 Answer 1

1

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.

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

Comments

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.