Using Spreadsheet, get 0x800a138f - JavaScript runtime error: Unable to get property 'replace' of undefined or null reference

Help! After finishing the VS2017 tutorial for starting a project, I had a date picker that seemed to be working great, so I jumped right in to added a spreadsheet instead. I replaced "<ej-date-picker id="datepicker" value="@DateTime.Now"></ej-date-picker>" with "<ej-spread-sheet id="Spreadsheet"></ej-spread-sheet>" as described on the spreadsheet tutorial.

Unfortunately, the spreadsheet doesn't finish loading. An error occurs in ej.web.min.js that leaves the spreadsheet in a "loading" state: The error is "0x800a138f - JavaScript runtime error: Unable to get property 'replace' of undefined or null reference" and occurs in on this line of code:

n.className=t?n.className.replace(new RegExp(t,"g"),"").replace(/ +/g," "):""

This is the only code in my Index.cshtml:

@{
    ViewData["Title"] = "Home Page";
}

<div class="panel panel-default">
    <div class="panel-heading">Spreadsheet?</div>
    <div class="panel-body">
        <ej-spread-sheet id="Spreadsheet"></ej-spread-sheet>
    </div>
</div>

I don't want to overload the post with code, so if you would like to see other portions of the project, please let me know. I really appreciate if anyone could point out what I need to do differently.

6 Replies

ZD Zach Durtschi May 10, 2017 05:25 PM UTC

In case it would be helpful, I have also attached here my entire project.
Attachment: SyncfusionSpreadsheet_c32e83a.zip


ZD Zach Durtschi May 10, 2017 08:42 PM UTC

One more update, I thought I would include my Visual Studio and Internet Explorer info:

IE 11
Version: 11.0.9600.18639
Update Versions: 11.0.41 (KB4014661)
Product ID: 00150-20000-00003-AA459

Visual Studio Professional 2017
Version 15.1 (26403.7) Release

If there's anything else that would help, let me know.



ZD Zach Durtschi May 10, 2017 10:41 PM UTC

I have found my problem! It turns out I put "<ej-script-manager></ej-script-manager>" in the wrong place, which for some reason was OK for the date picker but not the spread sheet. Unfortunately, I encountered another error "0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'ejSpreadsheet'"

But I will probably make a new post for that, since it is a different issue and my code has now changed.


SK Shanmugaraja K Syncfusion Team May 11, 2017 10:50 AM UTC

Hi Zach, 
 
Thanks for using Syncfusion products, 
 
We have checked your attached sample and found that you have referred jQuery file twice in the _Layout.cshtml page environment (“Development”) section. So, we suggest you to refer jQuery once in your _Layout file to resolve the reported issue. Please refer the below code example, 
 
[_Layout.cshtml] 
 
 
<!DOCTYPE html> 
<html> 
<head> 
    <environment names="Development"> 
        <link rel="stylesheet" rel='nofollow' href="~/css/site.css" /> 
        <link rel="stylesheet" rel='nofollow' href="~/lib/bootstrap/dist/css/bootstrap.css" /> 
        <link rel='nofollow' href="~/lib/syncfusion-javascript/Content/ej/web/bootstrap-theme/ej.web.all.min.css" rel="stylesheet" /> 
        <link rel='nofollow' href="~/lib/syncfusion-javascript/Content/ej/web/responsive-css/ej.responsive.css" rel="stylesheet" /> 
    </environment> 
     //.. 
    @Html.Raw(JavaScriptSnippet.FullScript) 
</head> 
<body> 
    //.. 
    <environment names="Development"> 
        <script src="~/lib/jquery/dist/jquery.js"></script> 
        <script src="~/lib/jsrender/jsrender.min.js"></script> 
        <script src="~/lib/syncfusion-javascript/Scripts/ej/web/ej.web.all.min.js"></script> 
    </environment> 
    <ej-script-manager></ej-script-manager> 
    @RenderSection("Scripts", required: false) 
</body> 
</html> 
 
 
Also, we have attached the modified sample and the same can be downloaded from the below location. 
 
 
Regards, 
Shanmugaraja K 



ZD Zach Durtschi May 11, 2017 11:28 PM UTC

Thank you for the response. I was able to get it working on my own - the main problem was that I place the Syncfusion JS files in the top scripts section instead of the bottom one. I also resolved the error I mentioned in my most recent post, so thank you.


SK Shanmugaraja K Syncfusion Team May 12, 2017 09:29 AM UTC

Hi Zach, 
 
We are happy to hear that your issue has been resolved. Kindly get back to us if you need further assistance. 
 
Regards, 
Shanmugaraja K 


Loader.
Up arrow icon