asp.netasp.net-mvcasp.net-mvc-5devexpress-mvc

ASP.NET MVC How do I add a new page in runtime?


so I am developing a MVC5 project and my situation is this:

I have a view called "Menu Editor" and I want to be able to add new pages from this view. By pages, I mean like, If someone wanted to create a new page called "Help", they write "Help" and press add,then an "Help" option appears in the navbar and you can click it and it redirects you to ".../Help" which would be created in runtime and just be a default view.

How can I do that and can I do that from view?

For the sake of simplicity lets assume I have a fresh ASP.NET MVC project since all I want to learn is how to do it and what is the correct syntax and It has nothing to do with my paragraphs of unsimplified code.

If that helps; I also have DevExpress plugin/extension installed and implemented.


Solution

  • System should post http request and add <li> node when post is successfull.

    1. Create an MVC action that process post action.
    2. Create AJAX post call to this action when client press "add" button, handle this call and add <li> node.
    3. location.assign("your-url") to get to your created page