This is a migrated thread and some comments may be shown as answers.

Does anyone know about "b.Application._doInitialize is not a function" JS error?

5 Answers 89 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Veteran
Matt asked on 13 Feb 2020, 06:42 PM
Uncaught TypeError: b.Application._doInitialize is not a function
    at Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl08_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bAjaxControlToolkit%2c+Version%3d4.1.60919.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3aen-US%3aee051b62-9cd6-49a5-87bb-93c07bc43d63%3aea597d4b%3ab25378d2:3
    at Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl08_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bAjaxControlToolkit%2c+Version%3d4.1.60919.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3aen-US%3aee051b62-9cd6-49a5-87bb-93c07bc43d63%3aea597d4b%3ab25378d2:3
    at q (Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl08_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bAjaxControlToolkit%2c+Version%3d4.1.60919.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3aen-US%3aee051b62-9cd6-49a5-87bb-93c07bc43d63%3aea597d4b%3ab25378d2:3)
    at Object.H.b._2Pass (Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl08_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bAjaxControlToolkit%2c+Version%3d4.1.60919.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3aen-US%3aee051b62-9cd6-49a5-87bb-93c07bc43d63%3aea597d4b%3ab25378d2:3)
    at F (Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl08_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bAjaxControlToolkit%2c+Version%3d4.1.60919.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3aen-US%3aee051b62-9cd6-49a5-87bb-93c07bc43d63%3aea597d4b%3ab25378d2:3)
    at HTMLDocument.d (Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl08_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bAjaxControlToolkit%2c+Version%3d4.1.60919.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3aen-US%3aee051b62-9cd6-49a5-87bb-93c07bc43d63%3aea597d4b%3ab25378d2:3)
    at HTMLDocument.c (Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl08_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bAjaxControlToolkit%2c+Version%3d4.1.60919.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3aen-US%3aee051b62-9cd6-49a5-87bb-93c07bc43d63%3aea597d4b%3ab25378d2:3)

5 Answers, 1 is accepted

Sort by
0
Matt
Top achievements
Rank 1
Veteran
answered on 13 Feb 2020, 06:46 PM
I get this when I load my page.
0
Matt
Top achievements
Rank 1
Veteran
answered on 13 Feb 2020, 06:49 PM

Here is my aspx code:

<%@ Page Title="Telerik Upload" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="TelerikUpload.aspx.cs" Inherits="ImportMPV2_WebTest.TelerikUpload" %>

<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">

<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
    <Scripts>
        <asp:ScriptReference Path="Scripts/PageScripts/TelerikUpload_aspx.js"></asp:ScriptReference>
    </Scripts>
</asp:ScriptManagerProxy>

<div style="margin:20px">
    File:
    <telerik:RadAsyncUpload
        AllowedFileExtensions="xlsx"
        EnableInlineProgress="true"
        HttpHandlerUrl="~/UploadHandler.ashx"
        ID="RadAsyncUpload1"
        MaxFileInputsCount="1"
        MultipleFileSelection="Disabled"
        OnClientFileSelected="OnClientFileSelected"
        OnClientFileUploaded="OnClientFileUploaded"
        OnFileUploaded="RadAsyncUpload1_FileUploaded"
        runat="server"
        >
        <FileFilters>
            <telerik:FileFilter Description="Excel Files(xlsx)" Extensions="xlsx" />
        </FileFilters>
    </telerik:RadAsyncUpload>
</div>

<div style="margin:20px">
    Sheet:
    <telerik:RadComboBox ID="SheetCb" name="SheetCb" runat="server" OnClientLoad="sheetCbLoad">
    </telerik:RadComboBox>
</div>

<div style="margin:20px">
    <telerik:RadButton AutoPostBack="true" runat="server" Text="Import">
    </telerik:RadButton>
</div>


<div style="margin:20px">
    <pre>
    <asp:label id="lblUploadResults" runat="server"></asp:label>
    </pre>
</div>

<div style="margin:20px">
    <pre>
    <asp:label id="lblSSISResults" runat="server"></asp:label>
    </pre>
</div>

</asp:Content>

0
Matt
Top achievements
Rank 1
Veteran
answered on 13 Feb 2020, 06:57 PM

Here is the code behind:

using System;
using System.Diagnostics;
using System.IO;
using System.Web.Configuration;
using System.Web.Services;
using System.Web.UI;
using Telerik.Web.UI;

namespace ImportMPV2_WebTest
{
    public partial class TelerikUpload : Page
    {
        [WebMethod]
        public static string GetSheetNames(string fileName)
        {
            string xlFilePath = _GetUploadedFileName(fileName);
            // Populate the sheet name combo box
            ImportMP importMP = new ImportMP(
                fileName,
                _UserName,
                _LogDir,
                _LogUniqueId
                );
            if (importMP.GetSheetNames() == 0)
            {
                return "[\"" + string.Join("\",\"", importMP.SheetNames) + "\"]";
            }
            else
            {
                // There's only going to be one error message
                return string.Format("\"{0}\"", importMP.ErrorMessages[0]);
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                _selectedSheet = SheetCb.SelectedItem.Text;
            }
        }

        protected void RadAsyncUpload1_FileUploaded(object sender, FileUploadedEventArgs e)
        {
            // Get the file info
            MyUploadedFileInfo fileInfo = (MyUploadedFileInfo) e.UploadResult;
            string xlFilePath = _GetUploadedFileName(fileInfo.TempFileName);

            // Display upload results
            lblUploadResults.Text = "File Uploaded\n"
                + "Original file name: " + fileInfo.FileName + "\n"
                + "Temp file name: " + fileInfo.TempFileName + "\n"
                + "Content type: " + fileInfo.ContentType + "\n"
                + "Content length: " + fileInfo.ContentLength + "\n"
                + "Selected sheet: " + _selectedSheet + "\n";


            // Time the execution
            Stopwatch executionTimer = new Stopwatch();
            executionTimer.Start();

            ImportMP importMP = new ImportMP(
                  xlFilePath
                , "gregorym"
                , _LogDir
                , _LogUniqueId
                );

            string s = string.Empty;
            if (importMP.CheckFileStructure(_selectedSheet) == 1)
            {
                s += string.Format("There are problems with the spreadsheet:\n{0}[{1}]:\n\n", xlFilePath, _selectedSheet);
                foreach (string msg in importMP.ErrorMessages)
                {
                    s += "    " + msg + "\n";
                }
            }
            else
            {
                importMP.Import(_selectedSheet);

                // Display import results
                s += "Import results:\n" + xlFilePath + ":\n\n";
                foreach (string msg in importMP.ErrorMessages)
                {
                    s += "    " + msg + "\n";
                }
                s += importMP.RowCountMessage + "\n";
            }

            // Stop the timer
            executionTimer.Stop();

            // Display the execution time
            int min = (int)executionTimer.ElapsedMilliseconds / 1000 / 60;
            int sec = (int)executionTimer.ElapsedMilliseconds / 1000 % 60;
            s += string.Format("Execution time: {0}:{1:D2}\n", min, sec);
            lblSSISResults.Text = s;

            // Clear the sheets dropdown
            SheetCb.Items.Clear();
        }

        private static string _GetUploadedFileName(string tempFileName)
        {
            return Path.Combine(WebConfigurationManager.AppSettings["Telerik.AsyncUpload.TemporaryFolder"], tempFileName);
        }

        private string _selectedSheet;

        private static string _UserName => "todo:username";
        private static string _LogDir => WebConfigurationManager.AppSettings["ImportMP.LogDir"];
        private static string _LogUniqueId => DateTime.Now.ToString("yyyyMMddhhmmssfff");
    }
}

0
Matt
Top achievements
Rank 1
Veteran
answered on 13 Feb 2020, 06:59 PM

Here is the only custom script on the page, TelerikUpload_aspx.js:

(function(global, undefined){
    var sheetCb = null;

    function sheetCbLoad(sender) {
        sheetCb = sender;
    }

    function OnClientFileSelected(sender, args) {
        var lblUploadResults = document.getElementById('MainContent_lblUploadResults');
        lblUploadResults.innerText = "";
        var lblSSISResults = document.getElementById('MainContent_lblSSISResults');
        lblSSISResults.innerText = "";
    }

    function OnClientFileUploaded(sender, args) {
        var fileInfo = args.get_fileInfo();

        $.ajax({
            type: "post",
            url: "TelerikUpload.aspx/GetSheetNames",
            data: JSON.stringify({ fileName: fileInfo.TempFileName }),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (result) {
                var sheetNames = JSON.parse(result.d);
                sheetNames.sort();
                // Add sheet names to combo box (sheetCb)
                sheetCb.clearItems();
                sheetCb.trackChanges();
                var cbItems = sheetCb.get_items();
                for (var sheetNameIx in sheetNames) {
                    var sheetName = sheetNames[sheetNameIx];
                    var cbItem = new Telerik.Web.UI.RadComboBoxItem();
                    cbItem.set_text(sheetName);
                    cbItems.add(cbItem);
                }
                sheetCb.commitChanges();
                cbItems.getItem(0).select();
            },
            error: function (jqXHR, textStatus, errorThrown) {
                var lblUploadResults = document.getElementById('MainContent_lblUploadResults');
                lblUploadResults.innerText = textStatus + "\n" + jqXHR.responseJSON.Message + "\n" + errorThrown;
            }
        });
    }
 
    global.OnClientFileSelected = OnClientFileSelected;
    global.OnClientFileUploaded = OnClientFileUploaded;
    global.sheetCbLoad = sheetCbLoad;
})(window);

0
Attila Antal
Telerik team
answered on 18 Feb 2020, 12:30 PM

Hi Matt,

I've looked into the source code of Telerik controls and I was unable to find any function called "_doInitialize". With that said, I believe this error message comes from a different source such as from a different JavaScript library.

You can make a quick test by creating a brand new ASPX page and only place the ScriptManager and the AsyncUpload controls and test this page. This page shall not throw the same exception.

Kind regards,
Attila Antal
Progress Telerik

Get quickly onboarded and successful with UI for ASP.NET AJAX with the Virtual Classroom technical trainings, available to all active customers. Learn More.
Tags
AsyncUpload
Asked by
Matt
Top achievements
Rank 1
Veteran
Answers by
Matt
Top achievements
Rank 1
Veteran
Attila Antal
Telerik team
Share this question
or