Re: Customize the look & feel of error message alert window

  •  09-19-2013, 1:44 PM

    Re: Customize the look & feel of error message alert window

    Hi Ken,

     

    I used your example and added an alert at the start of the error event funtion, like that:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="DD.UI.test" %>
    <%@ Register Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" TagPrefix="CuteWebUI" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <%--
    <%@ Register Assembly="CuteWebUI.AjaxUploader" Namespace="CuteWebUI" TagPrefix="ajaxuploader" %>  --%>

    <html>  
    <head>
      <script type="text/javascript">
          function CuteWebUI_AjaxUploader_OnError(msg) {
              alert(1);
              if (msg.indexOf("This file extension is not allowed! File extensions allowed") != -1) {
                  //show the message you want  
                  alert("this is a custom message");
                  return false;
              }
          }  
        </script>  
    </head>
    <body>  
        <form id="Form1" runat="server">  
            <CuteWebUI:Uploader runat="server" ID="uploader1" OnFileValidating="uploader1_FileValidating">  
                <ValidateOption AllowedFileExtensions="jpg" />  
            </CuteWebUI:Uploader>  
            
        </form>  
     
    </body>  
    </html>

     

    The function never get called. I tried to upload files that are not .jpg

     

    The code behind uploader1_FileValidating is not firing as well. 

     

    There's no specific error text that I want to catch. I need to catch the file type not allowed error and the file too large error. When I catch the error I would like to display the message in a different way then an alert.

    I just noticed that it is being fired when i upload .jpg file. Probably becuase of other missing settings but as I said not when when I upload a different file. 

View Complete Thread