Showing posts with label situation. Show all posts
Showing posts with label situation. Show all posts

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.

Need a double check on my options

I am not familiar with client side scripting.

My situation involves dynamic validation and masking of an asp.net textbox.

From reading articles and knowing what I think I know about server control, the only way to accomplish this is by using a client side raw javascript or using the new atlas clientside scripting functionality.

Just for verification, It is not possible to do it with just a server control, right?

Thanks for any input...

You could do it server-side but it would be an unberably bad user-experience. Any field masking should happen client side, and validation should happen on client and server side.

You usually do validation client sideand server side.

Masking involves the use of javascript. You need javascript to add and control the mask on the input element.

By the way, I am using the prototype version of MaskEdit control. It's included in the source code of Atlas Control Tookit.

It's very nice!

Cheers,

Leo


I will try the new control, thanx for the info.

One last question,

This is for a telephone number. I want to be able to mask on the insert template and display on the item template with the format (000) 000-0000.

The question is would you store it in the db as a nchar with formatting or as an integer and add and remove formatting on the server side?

Jamy