I have tried numerous approaches to prevent the default drop zone that is added by the AsynUpload to the page from showing or firing its drag events but have come up empty handed. As you can see by looking at my source code:
What I am trying to do is create a custom drop zone that encompasses the AsnycUpload control and two label controls. However, the default drop zone that the AsyncUpload also adds to the page is still added to the control as well, and as a result, the dragenter event of the default drop zone fires when you drag a file over the AsyncUpload elements (<ul> and <li> that have a dragenter event set). I and several developers at my company have attempted to unbind the dragenter events, but it seems like they are impossible to do so.
<div class="ssbUploaderDropZone"> <asp:Label runat="server" ID="lblTop" CssClass="ssbLabel ssbTopLabel"></asp:Label> <telerik:RadAsyncUpload runat="server" ID="RadAsyncUpload" CssClass="ssbImageUploader" DropZones=".ssbUploaderDropZone"> </telerik:RadAsyncUpload> <asp:Label runat="server" ID="lblBottom" CssClass="ssbLabel ssbBottomLabel"></asp:Label></div><asp:HiddenField runat="server" ID="hdnOrganizationNameFolder" /><telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel" RenderMode="Inline" style="display:none;"> <%--Provide support for this element when it is updated by RadAjaxManager or RadAjaxPanel--%> <telerik:RadScriptBlock runat="server"> <script> AsyncUploader.initialize('<%=this.ClientID%>'); </script> </telerik:RadScriptBlock></telerik:RadAjaxPanel><telerik:RadCodeBlock runat="server" ID="RadCodeBlock"> <script> $(document).ready(function () { AsyncUploader.initialize('<%=this.ClientID%>'); }); </script></telerik:RadCodeBlock>/// <summary>/// Wraps the usercontrol in a container div that is the ID of the usercontrol./// </summary>/// <param name="writer"></param>protected override void Render(HtmlTextWriter writer){ //Add a containing div element writer.Write("<div id=\"" + this.ClientID + "\" class=\"ssbUploaderContainer\">"); base.Render(writer); writer.Write("</div>");}.ruDropZone { display: none !important;}// -------------------------------------------------- //AsyncUploader// Async Uploader// -------------------------------------------------- //function AsyncUploader() { // Avoid using the window scope: // return a new util object if we're in the wrong scope if (window === this) { return new AsyncUploader(); } // Return the object return this;};// Prototype FunctionsAsyncUploader.prototype = { initialize: function (controlID) { /// <summary>Initialize the AsyncUploader control</summary> /// <param name="controlID" type="String">The ID of the AsyncUpload control to initialize</param> control = $("[id$='" + controlID + "']"); if (control[0]) { var dropZone = $(control).find(".ssbUploaderDropZone"); dropZone.bind({ "dragenter": function (e) { AsyncUploader.dragEnter(e, dropZone); } }); dropZone.bind({ "dragleave": function (e) { AsyncUploader.dragLeave(e, dropZone); } }); dropZone.bind({ "drop": function (e) { AsyncUploader.drop(e, dropZone); } }); } }, dragEnter: function (e, dropZone) { /// <summary>Handles the DragEnter event</summary> /// <param name="e" type="Event">The event that has occurred</param> /// <param name="dropZone" type="DOM Element">The dropZone DOM element</param> $(dropZone).css('border', '1px solid #000000'); $(dropZone).addClass('ssbUploaderDropZoneDragEnter'); }, dragLeave: function (e, dropZone) { /// <summary>Handles the DragLeave event</summary> /// <param name="e" type="Event">The event that has occurred</param> /// <param name="dropZone" type="DOM Element">The dropZone DOM element</param> $(dropZone).css('border', '0px none'); $(dropZone).removeClass('ssbUploaderDropZoneDragEnter'); }, drop: function (e, dropZone) { /// <summary>Handles the Drop event</summary> /// <param name="e" type="Event">The event that has occurred</param> /// <param name="dropZone" type="DOM Element">The dropZone DOM element</param> $(dropZone).css('border', '0px none'); $(dropZone).removeClass('ssbUploaderDropZoneDragEnter'); }};//intialize SimplePopover for usevar AsyncUploader = new AsyncUploader();What I am trying to do is create a custom drop zone that encompasses the AsnycUpload control and two label controls. However, the default drop zone that the AsyncUpload also adds to the page is still added to the control as well, and as a result, the dragenter event of the default drop zone fires when you drag a file over the AsyncUpload elements (<ul> and <li> that have a dragenter event set). I and several developers at my company have attempted to unbind the dragenter events, but it seems like they are impossible to do so.