Customize the look & feel of error message alert window

Last post 09-19-2013, 2:33 PM by Kenneth. 8 replies.
Sort Posts: Previous Next
  •  09-16-2013, 4:43 AM 77986

    Customize the look & feel of error message alert window

    Hi, 

     

    Is it possible to customize the look & feel of error messages i.e. can I use a customized alert window instead of the default alert for file not allowed message? I would like to use telerik radWindow/radAlert instead.

     

    Thanks 

  •  09-16-2013, 12:47 PM 77987 in reply to 77986

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

    Hi novi,

     

    Yes, you can catch the default error and achieve your own login. Please refer to http://www.ajaxuploader.com/document/scr/html/How-to-catch-uploader-error.htm, it shows you how to catch the uploader error.

     

    Regards,

     

    Ken 

  •  09-17-2013, 2:10 PM 77992 in reply to 77987

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

    Hi Ken,

     

    I'm not that I understand. Here is part of my code: 

     

    <CuteWebUI:Uploader runat="server" ID="Uploader1" ManualStartUpload="true" 
                           MultipleFilesUpload="false" InsertButtonID="btnSelectFiles" 
                           ProgressCtrlID="pnlProgress" ProgressTextID="lblProgress"  ProgressPanelWidth="270"
                           CancelButtonID="btnCancelUpload"  OnFileUploaded="Uploader_FileUploaded"
                            ProgressInfoStyle="display:none"   ProgressPicture="images/dropbox/pb.jpg" FileTypeNotSupportMsg="This file type is not allowed"    
                            ProgressBarBackgroundImage="images/dropbox/pb_bg.jpg" ProgressBarHeight="11" ProgressBarBorderStyle="height:0; margin-left:4px;" ProgressBarStyle="Continuous" >

     <ValidateOption MaxSizeKB="2097152" AllowedFileExtensions=".zip,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.gif,.tiff,.jpg,.png,.bmp,.wmv,.avi,.mp4,.rtf,.txt" />
                        </CuteWebUI:Uploader>

     

    I would like the message "This file type is not allowed" to not use the default java script alert and instead display it on the page or use a custom lightbox. The events you mentoined are not fired and I still get a js alert with the mentioned message.

     

    What am I doing wrong? 

     

    Thanks 

  •  09-17-2013, 2:39 PM 77993 in reply to 77992

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

    Hi,

     

    Please try the example below. It shows you how to catct the "This file extension is not allowed! File extensions allowed" error and achieve your own logic there. The example below will shows the custom alert message.

     

    1. <%@ Page Language="C#" AutoEventWireup="True" %>  
    2.   
    3. <%@ Register Assembly="CuteWebUI.AjaxUploader" Namespace="CuteWebUI" TagPrefix="ajaxuploader" %>  
    4. <html>  
    5. <body>  
    6.     <form id="Form1" runat="server">  
    7.         <CuteWebUI:Uploader runat="server" ID="uploader1">  
    8.             <ValidateOption AllowedFileExtensions="jpg" />  
    9.         </CuteWebUI:Uploader>  
    10.     </form>  
    11.     <script type="text/javascript">  
    12.         function CuteWebUI_AjaxUploader_OnError(msg) {  
    13.             if (msg.indexOf("This file extension is not allowed! File extensions allowed") != -1) {  
    14.                 //show the message you want  
    15.                 alert("this is a custom message");  
    16.                 return false;  
    17.             }  
    18.         }  
    19.     </script>  
    20. </body>  
    21. </html>  
     

    Regards,

     

    Ken 

  •  09-19-2013, 3:30 AM 77995 in reply to 77993

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

    Hi Ken,

     

    I tested your exmaple and the CuteWebUI_AjaxUploader_OnError(msg) event never fires.  Any Ideas why?

     

    Thanks 

  •  09-19-2013, 1:17 PM 77998 in reply to 77995

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

    Hi novi,

     

    Can you show me the full error message which you want to catch?

     

    In the example I attached, it only allow to upload .jpg file, please try to upload a .gif .txt file, then it will catch the error and show the custom error message?

     

    Regards,

     

    Ken 

  •  09-19-2013, 1:44 PM 78000 in reply to 77998

    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. 

  •  09-19-2013, 2:31 PM 78001 in reply to 78000

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

    Hi novi,

     

    Can you post your email address here? So I can send the example page to you directly. Also, you can send a mail to Kenneth@CuteSoft.net directly.

     

    If your site online now? if yes, can you send me the uploader page url? so I can check it too.

     

    Regards,

     

    Ken 

  •  09-19-2013, 2:33 PM 78002 in reply to 78001

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

    hi novi,

     

    by the way file type not support and file too large message can set by the properties below directly.

     

       <CuteWebUI:Uploader runat="server" ID="uploader1"  FileTypeNotSupportMsg="not support" FileTooLargeMsg="too large">        </CuteWebUI:Uploader> 

     

    Regards,

     

    Ken 

View as RSS news feed in XML