Re: How to put errors in the Validation Summary

  •  10-10-2010, 9:56 PM

    Re: How to put errors in the Validation Summary

    Hi microcontroleur,
     
    The example below shows you how to catch the error message of uploader and use your own method to show you own message.
     
    1. <%@ Page Language="C#" %>  
    2.   
    3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    4. <html xmlns="http://www.w3.org/1999/xhtml">  
    5. <head runat="server">  
    6.     <title>Untitled Page</title>  
    7. </head>  
    8. <body>  
    9.     <form id="form1" runat="server">  
    10.         <CuteWebUI:UploadAttachments ID="attachment1" runat="server" InsertText="Upload1">  
    11.             <ValidateOption MaxSizeKB="10" />  
    12.         </CuteWebUI:UploadAttachments>  
    13.              <asp:Label ID="errorMessage" runat="server"></asp:Label>  
    14.     </form>  
    15. </body>  
    16. </html>  
    17.   
    18. <script>  
    19.    function CuteWebUI_AjaxUploader_OnError(msg)  
    20.     {  
    21.         //Catch errors  
    22.         if(msg.indexOf("is too large")!=-1)  
    23.         {  
    24.             //show the message you want  
    25.             var errorMessage=document.getElementById("<%= errorMessage.ClientID %>");  
    26.             errorMessage.innerHTML="The file is too large";  
    27.             return false;  
    28.         }  
    29.     }  
    30. </script> 
    Regards,
     
    ken
View Complete Thread