Keep getting a javascript error while upload, the 1st time

Thread is closed for posting
2 posts, 0 answers
  1. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 10 Jul 2014 Link to this post

    It seems to fail on this line
    var f=e.get_handled();
    if(!f){throw"Error while uploading, "+i;a("object",j).remove();

    But if I try again it works.  And if the cache isn't cleared it works.  I moved the custom javascript to the bottom and I think the web.config is ok, but here is my code:

    <%@ Page Language="C#" AutoEventWireup="true" Inherits="AssocUploader" CodeBehind="AssocUploader.aspx.cs" %>
     
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
     
    <!DOCTYPE html>
     
    <head runat="server">
        <title></title>
        <script type="text/javascript" src="http://cdn.kendostatic.com/2014.1.416/js/jquery.min.js"></script>
     
    </head>
     
    <body style="font-family: Verdana; font-size: 12px; background-color: lightblue">
     
     
        <form id="form1" runat="server">
     
                        <telerik:RadScriptManager ID="RadScriptManagerAssocUp" EnablePartialRendering="true" runat="server"></telerik:RadScriptManager>
     
            <telerik:RadAjaxManager ID="RadAjaxManagerAAUp" runat="server" />
            <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanelAAUp">
     
     
     
                <div>
                    <table>
                        <tr>
                            <td style="text-align: center" colspan="2">
                                <asp:Label Text="Upload File with Description" Font-Bold="true" Font-Size="15px" runat="server" />
                                <br />
                                <br />
                            </td>
                        </tr>
                        <tr>
                            <td>File Description</td>
                            <td>
                                <telerik:RadTextBox runat="server" Width="200px" ID="tbFileDesc" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <br />
     
                                <telerik:RadAsyncUpload ID="radUpAssoc" runat="server"
                                    Width="250px" OnClientFileUploaded="fileUploaded" DisablePlugins="true"
                                    ChunkSize="2097152" DisableChunkUpload="False"
                                    MultipleFileSelection="Disabled" OnClientFileUploadFailed="onFileFailed"
                                    ManualUpload="true" OnClientFileUploading="onClientFileUploading"
                                    HttpHandlerUrl="~/AssocUploadHandler.ashx"
                                    AllowedFileExtensions="pdf">
                                </telerik:RadAsyncUpload>
     
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="button" onclick="startManualUpload()" value="start upload" />
     
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label Text="" ForeColor="DarkRed" runat="server" ID="txtError" />
                                <br />
                                <asp:Label Text="" ForeColor="DarkGreen" runat="server" ID="txtDebug" />
                            </td>
                        </tr>
                    </table>
                </div>
            </telerik:RadAjaxPanel>
     
        </form>
            <telerik:RadCodeBlock runat="server" ID="radCodeBlock1">
            <style type="text/css">
                .RadUpload_Default .ruFakeInput {
                    display: none !important;
                }
            </style>
            <script type="text/javascript">
     
              
                        function fileUploaded(sender, args) {
                            document.getElementById("txtDebug").innerText = 'File has uploaded.  Close the window or add another file';
                        }
                        function onFileFailed(sender, args) {
                            document.getElementById("txtDebug").innerText = '';
                            document.getElementById("txtError").innerText = 'File Upload Failed';
                        }
                        function startManualUpload() {
                            var tb = $find('<%=tbFileDesc.ClientID%>');
                            var tbtxt;
                            try {
                                tbtxt = tb._text.length;
                            }
                            catch (err) {
                                document.getElementById("txtError").innerText = 'Description Error:' + err;
                                return;
                            }
                             
                            if (tbtxt == 0) {
                                document.getElementById("txtError").innerText = 'Enter Description';
                            }
                            else {
                                try {
                                    var upload = $find('<%=radUpAssoc.ClientID%>');
                                    upload.startUpload();
                                    document.getElementById("txtError").innerText = '';
                                }
                                catch (err) {
                                    document.getElementById("txtError").innerText = 'Upload Exception:' + err;
                                    return;
                                }
                            }
                        }
                         
                        function onClientFileUploading(sender, args) {
                            var tb = $find('<%=tbFileDesc.ClientID%>');
                            var tbtxt = tb._text
     
                            var obj = { desc: tbtxt };
                            args.set_queryStringParams(obj);
                        }
               
                    if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
            </script>
            </telerik:RadCodeBlock>
        </body>
     
    </html>
  2. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 15 Jul 2014 Link to this post

    Hi Dan,

    The pasted code seems to working correctly. What is your browser? What version of Telerik assemblies do you use?

    Regards,
    Hristo Valyavicharski
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top