[out of date post... this deals with MS Atlas CTP... which has been change drastically and is now MS Ajax Extensions]
This is the type of post you don’t really want to write. You always want to speak from great knowledge from on high to the masses. Unfortunately, I did something stupid tonight. I decided that I could extend the DragOverlayExtender in about an hour and could easily start to add some features like grabbing the position of the element (mind you I have really only given this aspect of Atlas a cursory look before tonight). In the process I learned quite a bit, but not quite what I wanted to know.
So let’s start with the extenders. Atlas has these really cool “extenders” that when dropped on a web form will extend additional functionality to every control on the form. For instance, the new rounded corners extender (part of the Atlas Control Toolkit) lets you round the edges of your panels to have a more rounded look as opposed to the standard box with sharp corners.
The DragOverlayExtender let’s you make panels movable and can store this information back to a user profile (which is part of the whole new membership security model… I know a lot more about that than I have written)
So my goal tonight was relatively simple (or so I thought). I wanted to create a drag-able region and:
- Detect the position of the element on the server via the new TimerControl’s tick event
- Update a label with this information
- (optionally) detect when this movable region was on top of another region
Ultimately, while I think drag is cool, what I really want is drag/drop. So I need to be able to detect if the dragged region is now on top of another drop zone panel.
So the first attempt ended up with nothing but a form that ticks back to the server and let’s me drag the “Move Me” panel all over the screen. But, I can’t detect the position. There’s no place to detect it on the server.
So my next thought was to inherit the DragOverlayExtender. I was looking for some hidden property; I even went so far as to run it through Reflector to take a look at the source code… It was at this point that I realized the fundamental nature of Atlas components. Ready? I know this will come as a big revelation to you. The server side component of Atlas controls is minimal. Much of the work is on the client side… Duhhh!
This has lead me to a place where I now think I understand how to really develop an Atlas control. Play around in the client side first; get your idea working there. Learn how to build the client side behaviour and then build your server side control to take advantage of these behaviours. You will save yourself a lot of headaches…
BTW, my investigation has shown me that that while there is currently only a DragOverlayExtender the float behavior (which is what the DragOverlayExtender is built on top of) is most certainly capable of Drag and Drop (complete with Drop Zones!)
When I work out the code (if MS doesn’t beat me first) I’ll post it here.
[tags: Atlas, ASP.Net, Ajax]
| posted on Sunday, May 21, 2006 2:43 AM