This project is read-only.

MVC example in combination with DroppableZone

Topics: Developer Forum
Oct 17, 2008 at 2:48 AM
Edited Oct 17, 2008 at 2:52 AM

I tried to combine your MVC example with "Parts" using n2:DroppableZone but when I select "Organize parts"-mode I get a javascript error and I cant drag/drop any of the parts.
The JS error: "'dropZones' is undefined." I tried to add AllowExternalManipulation="true" to the n2:DroppableZone control in hope to see any change but then got the following error when selecting "Organize parts".
The null reference below referers to "item" being null.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 20: 			CssClass = "dropPoint " + zoneName;
Line 21: 			if (position == CreationPosition.Below)
Line 22:                             ID = "dp_" + item.ID + "_" + zoneName;
Line 23: else Line 24:     ID = "dp_" + item.ID;

Source File: C:\Documents and Settings\mathog\Desktop\N2_Source\N2_Source\src\N2\Web\UI\WebControls\DropPoint.cs    Line: 22

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
   N2.Web.UI.WebControls.DropPoint..ctor(String zoneName, ContentItem item, CreationPosition position, String backImageUrl) in C:\Documents and Settings\mathog\Desktop\N2_Source\N2_Source\src\N2\Web\UI\WebControls\DropPoint.cs:22
   N2.Web.UI.WebControls.DroppableZone.AddDropPoint(Control container, ContentItem item, CreationPosition position) in C:\Documents and Settings\mathog\Desktop\N2_Source\N2_Source\src\N2\Web\UI\WebControls\DroppableZone.cs:87
   N2.Web.UI.WebControls.DroppableZone.CreateItems(Control container) in C:\Documents and Settings\mathog\Desktop\N2_Source\N2_Source\src\N2\Web\UI\WebControls\DroppableZone.cs:40
   N2.Web.UI.WebControls.Zone.CreateChildControls() in C:\Documents and Settings\mathog\Desktop\N2_Source\N2_Source\src\N2\Web\UI\WebControls\Zone.cs:133
   System.Web.UI.Control.EnsureChildControls() +87
   N2.Web.UI.WebControls.Zone.OnInit(EventArgs e) in C:\Documents and Settings\mathog\Desktop\N2_Source\N2_Source\src\N2\Web\UI\WebControls\Zone.cs:83
   System.Web.UI.Control.InitRecursive(Control namingContainer) +333
   System.Web.UI.Control.InitRecursive(Control namingContainer) +210
   System.Web.UI.Control.InitRecursive(Control namingContainer) +210
   System.Web.UI.Control.InitRecursive(Control namingContainer) +210
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +378


Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053

I have the DragDropControlPanel in the MasterPage, the AvailableZone attribute to the model for the page and I have added the AllowedZones attribute to the model for the part.
I am using your source
Do you have any idea what might cause this error?

PS. Tack Cristian för ett open source CMS med potential, du är en klippa. :-)

Oct 17, 2008 at 6:59 PM
The exception is probably due to the page handler not beeing an IPageTemplate. However there are other problems. I'm guessing the ViewPage's ClientScript or the page lifecycle works differently. An alternative solution would probably have to be devised. Sorry.