I'm building a dragbuttonextender which purpose is to extend button control so that it can be dragged and dropped. In AjaxControlToolkit's implementation of DragPanel in FloatingBehavior.js there is a functioncheckCanDrag which looks like:
this.checkCanDrag = function(element) {
var undraggableTagNames = ["input", "button", "select", "textarea", "label"];
var tagName = element.tagName;
if ((tagName.toLowerCase() == "a") && (element.href != null) && (element.href.length > 0)) {
return false;
}
if (Array.indexOf(undraggableTagNames, tagName.toLowerCase()) > -1) {
return false;
}
return true;
}
My question is:Why are buttons and input controls undraggable?
I wrote my extender (which extends ASP.NET Button controls) and I can drag&drop buttons. The problem is that when drag&drop ends a full postback occurs and position of the button is restored to its original location. When I use my extender (which is currently almost identical to AjaxControlToolkit's DragPanelExtender except checkCanDrag function) to extend ASP.NET Panel control then everything works fine and panels are placed where I dropped them. When I put buttons in a panel and attach my extender to this panel, again everything works fine. So, why can't buttons be extended just like panels are extended?
Anybody?
No comments:
Post a Comment