Search code examples
routesumbraco

Umbraco using mvc in backoffice


I created custom section in tree and added items. When I click this item I redirect to App_Plugins/ProjName/BackOffice/folder/edit.html

And I have question it possible use example partial view and mvc controller to display details? I found examples with only angular.


Solution

  • Yes. It is possible. By default Umbraco expects you to use Angular for everything in the back office. However, there is some functionality that allows the older sections of Umbraco that haven't been ported to Angular to load that you can use.

    You can make it so that your custom tree items have a URL set to point to "/SECTION NAME/framed/URL ENCODED URL TO YOUR MVC VIEW".

    Here's an example of creating a tree node in a custom tree controller that does this:

    var item = this.CreateTreeNode("dashboard", id, queryStrings, "Dashboard", "icon-dashboard", true);
    
    item.RoutePath = "/ReportingSection/framed/%2Fumbraco%2Fbackoffice%2FMySection%2FReportingSection";
    
    nodes.Add(item);
    

    In this example, we're loading a framed version of

    "/umbraco/backoffice/MySection/ReportingSection/"

    which is an Umbraco Back Office Controller that return some conventional MVC stuff.