Re: CuteWebUI_AjaxUploader_OnError Doesn't Fire

  •  02-23-2011, 2:35 PM

    Re: CuteWebUI_AjaxUploader_OnError Doesn't Fire

    Dear mferrell3,
     
    Please follow steps:
     
    1. Save the following code to default.aspx

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script type="text/javascript">

    function CuteWebUI_AjaxUploader_OnError(msg) {
    alert(1);
    return false;
    }
    </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
          <CuteWebUI:UploadAttachments ShowFrameBrowseButton="false" InsertText="Upload Multiple files Now" runat="server"
                    ID="Attachments1" onfilevalidating="Attachments1_FileValidating" MultipleFilesUpload="true" >
                  
                </CuteWebUI:UploadAttachments>
        </div>
        </form>
    </body>
    </html>

    2. Save the following code to default.aspx.cs

    using System;
    using System.Collections.Generic;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }
        protected void Attachments1_FileValidating(object sender, CuteWebUI.UploaderEventArgs args)
        {                 
                throw new Exception("test");       
        }
    }
    3. Run default.aspx and upload one file, you will find  CuteWebUI_AjaxUploader_OnError will be fired.
    Please check your snippet, check whether the highlighted line is called:
     if (System.IO.File.Exists(ResourceFilePath + "Skin\\" + Skin.Id + "\\" + args.FileName)) 
     {   
                 ErrorTextBox.Text = "file name error";   
                 throw new Exception("test");            
      }
     
    Thank you for asking
     
     
View Complete Thread