Saturday, March 24, 2012

Namespace Help Please (Custom Composite Control/Extenders Project)

Ugh! Okay, so here's the situation. I have 2 custom extenders and a compsite control in a dll project. What is the best way to organize the files? I want to be able to access the extenders from any asp page as well.


The extenders are: DropZoneExtender and DragItemExtender
The control is: DragDropRepeater

Here's the file structure I have for the project ..

My problem is that while there are no immediate namespace issues, when the page is loaded I get the familiar "Assertion Failed: Unrecognized tag dropzone:DropZoneBehavior" popup.

Here's what the code looks like:

// DropZoneBehavior.js

Type.registerNamespace('DropZone');
DropZone.DropZoneBehavior = function() {
DropZone.DropZoneBehavior.initializeBase(this);
...
// code
..
}
DropZone.DropZoneBehavior.registerSealedClass('DropZone.DropZoneBehavior', AtlasControlToolkit.BehaviorBase, Sys.UI.IDropTarget);
Sys.TypeDescriptor.addType('DropZone', 'DropZoneBehavior', DropZone.DropZoneBehavior);

 
// DropZoneExtender.cs#region Assembly Resource Attribute[assembly: System.Web.UI.WebResource("DragDropRepeater.DropZone.DropZoneBehavior.js","text/javascript")]
#endregion
namespace DropZone
{
[ClientScriptResource("DropZone","DropZoneBehavior","DragDropRepeater.DropZone.DropZoneBehavior.js")]
[RequiredScript(FrameworkScript.AtlasUIDragDrop)]
public class DropZoneExtender : ExtenderControlBase
{
}
}
Anyone have any suggestions?

Hey,

I tried to fin the post, but no luck. Look for Case - Sensitive on the Atlas lists. The last Atlas Update made changes for Safari, and for some reason it needs the Namespace lowercase.

here is the current Script namespace. Now lowercase.

Sys.UI.DraggableListItem.registerSealedClass('Sys.UI.DraggableListItem', Sys.UI.Behavior);
Sys.TypeDescriptor.addType('script', 'draggableListItem', Sys.UI.DraggableListItem);

So change your:

DropZone.DropZoneBehavior.registerSealedClass('DropZone.DropZoneBehavior', AtlasControlToolkit.BehaviorBase, Sys.UI.IDropTarget);
Sys.TypeDescriptor.addType('dropzone', 'DropZoneBehavior', DropZone.DropZoneBehavior);

also change your

[ClientScriptResource("dropzone", "DropZoneBehavior", "DragDropRepeater.DropZone.DropZoneBehavior.js")]

Here is the link!!!

http://forums.asp.net/thread/1276996.aspx

Good luck.

Eric Wild


I figured it out, and actually its a little more complicated. I'm considering making a blog post about it.

Oh and lol .. remember, when you are creating the extenders from scratch .. make sure you mark the javascript files as an embedded resource. *smacks forehead* I used the example of the ReorderList, which is essentially what I'm creating where its based on the non-list versions of the dragdropUI and where reordering is not important, just the dragdrop.

No comments:

Post a Comment