c# - AsyncFileUpload does not fire server side UploadComplete -
i have asyncfileupload control inside update panel in page using master page. when select file, client side onclientuploadcomplete fires not server side. searched issue , tried different suggestions, including adding hidden button outside update panel , "click" on client script force async postback modifying "form" tag on master page include encrypt type nothing seems working.
in aspx file have:
<script type="text/javascript"> function onclientuploadcomplete(sender, e) {debugger var ct = e.get_contenttype(); var fn = e.get_filename(); var l = e.get_length(); var p = e.get_path(); document.getelementbyid('uploadcompleteinfo').innerhtml = ''; __dopostback('upnlnews', ''); } function onclientuploadstart(sender, e) { document.getelementbyid('uploadcompleteinfo').innerhtml = 'please wait while uploading ' + e._filename; } </script> <asp:updatepanel runat="server" id="upnlnews"> <contenttemplate> <ajaxtoolkit:asyncfileupload runat="server" id="fuattcheddocs" throbberid="mythrobber" uploaderstyle="traditional" onclientuploadcomplete="onclientuploadcomplete" onuploadedcomplete="fuattcheddocs_uploadedcomplete" onuploadedfileerror="fuattcheddocs_uploadedfileerror" /> <asp:label runat="server" id="mythrobber" style="display: none;"> <img align="middle" alt="" src="../assets/images/6.gif" /> </asp:label> <div id="uploadcompleteinfo"></div><br /> </contenttemplate> </asp:updatepanel>
additional info when put breakpoint in client side script , check variables in chrome developer tool, see following:
function onclientuploadcomplete(sender, e) {debugger var ct = e.get_contenttype(); ==> ct = "" var fn = e.get_filename(); ==> fn = "spock.jpg" var l = e.get_length(); ==> l = "nan" var p = e.get_path(); ==> p = "c:\fakepath\spock.jpg" document.getelementbyid('uploadcompleteinfo').innerhtml = ''; __dopostback('upnlnews', ''); }
the fact file length shows nan bit fishy!
i found out ui designer had added search text box , button combo , had contained them in <form>...</form> tag; page 2 <form> tags, 1 contained within other (main page form tag , one). broke code. realized when found regular button not fire onclick event. after changed form tags div worked fine.
Comments
Post a Comment