CuteWebUI_AjaxUploader_OnStart() Not being called!

  •  08-18-2009, 10:14 AM

    CuteWebUI_AjaxUploader_OnStart() Not being called!

    Hello,
     
    I'm working on using the uploader in an MVC application and one of the things we need to do is disable some things on the page while an upload is occuring.   I read other posts saying to use the  CuteWebUI_AjaxUploader_OnStart() function but it isn't being called!    the OnStop function is not being called either.     The On_Postback()  does get called.  
     
    Here's my View code:
     
    1. <%@ Page Title="" Language="VB" MasterPageFile="~/Views/Shared/ExtraPlain.Master" Inherits="System.Web.Mvc.ViewPage" %>  
    2.   
    3.   
    4. <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">  
    5. <script type="text/javascript">  
    6.     var handlerurl = '<%=Url.Action("AjaxSubmit", "FileUpload") %>'  
    7.     </script>  
    8.     <script type="text/javascript">  
    9.         function CuteWebUI_AjaxUploader_OnStart() {  
    10.             //this function would be called on each file start upload  
    11.             //maybe be called many times when upload multiple files.  
    12.             $('#SendMail').attr("disabled""disabled");  
    13.             document.getElementById("SendMail").disabled = "disabled";  
    14.             alert("hello");  
    15.               
    16.               
    17.         }  
    18.         function CuteWebUI_AjaxUploader_OnStop() {  
    19.             //this function would be called if get error or user cancel it.  
    20.             $('#SendMail').removeAttr("disabled");  
    21.             alert("hello");  
    22.         }  
    23.          
    24.           
    25.   
    26.         function CuteWebUI_AjaxUploader_OnPostback()  
    27.         {  
    28.             //$('#SendMail').attr("disabled", "disabled");   
    29.              
    30.             var uploader = document.getElementById("TheFileUploader");  
    31.             var guidlist = uploader.value;  
    32.             var otherinfo = document.getElementById("otherinfo").innerHTML;  
    33.             //Send Request  
    34.   
    35.             $.post(  
    36.                 handlerurl,  
    37.                 { guidlist: guidlist, otherinfo: otherinfo },  
    38.                 function(data, status) {  
    39.                     if (status != "success") {  
    40.                         alert("http error " + status);  
    41.                         setTimeout(function() { document.write(xh.responseText); }, 10);  
    42.                         return;  
    43.                     }  
    44.                       
    45.                     var filelist = document.getElementById("filelist");  
    46.   
    47.                     var list = eval(data); //get JSON objects  
    48.                       
    49.                     for (var i = 0; i < list.length; i++)  
    50.                     {  
    51.                         var item = list[i];  
    52.                         var msg;  
    53.                         if (item.Error != null)  
    54.                         {  
    55.                             msg = "Error " + item.FileGuid + " - " + item.Error;  
    56.                         }  
    57.                         else  
    58.                         {  
    59.                             msg = "Processed : " + list[i].FileName;  
    60.                         }  
    61.                         var li = document.createElement("li");  
    62.                         li.innerHTML = msg;  
    63.                         filelist.appendChild(li);  
    64.                       
    65.                     }  
    66.   
    67.   
    68.                 }  
    69.              );  
    70.              uploader.reset();  
    71.              $('#SendMail').removeAttr("disabled");  
    72.         }  
    73.       
    74.     </script>  
    75.   
    76.     <button id="uploadbutton" onclick="return false;" name="uploadbutton">Select file(s) to upload</button>  
    77.     <%=ViewData("uploaderhtml") %>  
    78.     <ol id="filelist"></ol>  
    79.       
    80.     <div id="otherinfo" name="otherinfo" style="display:none;">Hello!</div>  
    81.     <input type="button" id="SendMail" name="SendMail" value="SendMail" />  
    82.       
    83. </asp:Content> 
     Any idea where i'm going wrong?
     
    Thanks!

     
View Complete Thread