View | Modify | History

Drag and drop

Introduction

Drag and drop is archieved in the N2 cms by specifying 'Zones' for N2.ContentItems to be dropped on.

Decorate your Class which extends from N2.ContentItem with N2.Integrity.AllowedZoneszonename, zonename, ... to specify on which zones it can be dropped.

Decorate the page Class which extends from N2.ContentItem on which you want to drop the contentItem with N2.Integrity.AvailableZone"Displayname", "zoneName"

Place an asp marker in the template so the N2 CMS knows where the actual zone is located.

Example

N2.Integrity.AvailableZone("My Zone", "sidebarZone")
public class MyPage: N2.ContentItem
{
//page attributes etc declared here
}

N2.Integrity.AllowedZones("sidebarZone", "anotherZoneName")
N2.Definition("Blog Teaser", "Blog")
public class BlogWidget : N2.ContentItem
{
//code for your widget here
}

And in your .ascx file for your MyPage:

It will now be possible to organize parts for your page from within the cms and to place your BlogWidget on the sidebarZone

You can further limit which ContentItem can be placed where by providing other decorators like