Search code examples
asp.net-mvcrazorn2

In N2CMS MVC with Razor, how do you add the Control Panel and Zones?


If you were using N2CMS MVC with the ASP.NET view engine, you would using the following code to add the Control Panel and a Zone to the page.

<n2:SlidingCurtain ID="sc" runat="server">
    <n2:ControlPanel runat="server" EnableEditInterfaceIntegration="false" />
</n2:SlidingCurtain>
<n2:DroppableZone ID="Zone2" ZoneName="Left" runat="server" />

Is this even possible using the Razor view engine to enable the drag-n-drop zones? If so what is the syntax?

I have tried:

@{ Html.DroppableZone("Left").Render(); }
@{ Html.RenderZone("Left"); }

The above code renders the zone, but I am not sure how to enable the control panel or how to invoke the drag-n-drop style zone editing.


Solution

  • Turns out I was close.

    Adding the following to the _Layout.cshtml enabled the Control Panel.

    @{ Html.ControlPanel().Render(); }
    

    And using DroppableZone enabled a target for the drag-n-drop.

    @{ Html.DroppableZone("Left").Render(); }
    

    Add the appropriate namespace to make sure the extension methods are available.

    @using N2.Web.Mvc.Html;