Re: How can I throw a server side error if file upload is not successful

  •  08-05-2011, 7:47 AM

    Re: How can I throw a server side error if file upload is not successful

    hi RonR,
     
    Please try the example below. Upload a large file to fire the error.
     
    <%@ Page Language="C#" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <script runat="server">

        protected void b1_Click(object sender, EventArgs e)
        { //add you server side method here
            lbErrorMessage.Text = "server side error message";
        }
    </script>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>example</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <CuteWebUI:UploadAttachments ID="attachemnt1" runat="server">
                <ValidateOption MaxSizeKB="100" />
            </CuteWebUI:UploadAttachments>
            <asp:Label ID="lbErrorMessage" runat="server"></asp:Label>
            <asp:Button ID="b1" runat="server" Style="visibility: hidden" OnClick="b1_Click" />
        </form>
    </body>
    </html>

    <script>
       function CuteWebUI_AjaxUploader_OnError(msg)
    {
        var b1=document.getElementById("<%= b1.ClientID %>");
        b1.click();
        return false;
    }

    </script>
     
    Regards,
     
    Ken
View Complete Thread