I have created a Grid and it renders on the Page but none of the Actions are firing (Read, Create, Update, Destroy) and no data is being displayed and also no styling
On pressing F12 I receive a number of JavaScript Errors:
Unexpected Token '{' kendo.all.min.js:9
Cannot read property 'extend' of undefined kendo.aspnetmvc.js:52
Cannot read property 'ContextMenu' of undefined kendo.grid.js:7609
kendo.synReady is not a Function.
The ordering of Scripts in _Layout.cshtml is
- jquery-3.7.1.min.js
- kendo.all.min.js
- kendo.aspnetmvc.min.js
- kendo.grid.min.js
The Stylesheet is set as default-main.css
Am I missing a reference or is the ordering is incorrect.
Many Thanks
Hello Mark,
Your script order is almost right, but you have too many Kendo files. kendo.all.min.js already includes the Grid and everything else, so loading kendo.grid.min.js on top of it causes conflicts. Use this order:
<script src="~/scripts/jquery-3.7.1.min.js"></script> <script src="~/scripts/kendo/kendo.all.min.js"></script> <script src="~/scripts/kendo/kendo.aspnetmvc.min.js"></script>Remove the kendo.grid.min.js line. jQuery must always come first, then kendo.all, then kendo.aspnetmvc. All Kendo files must come from the same version, so check that the version in the file names matches the version of your Telerik UI for ASP.NET MVC package.
The "Unexpected token '{'" error often means the browser got something other than the real JavaScript file. The most common cause is a wrong path, which makes the server return a 404 page or a different file. To check, press F12, open the Network tab, reload the page, and look for any red entries. Click kendo.all.min.js and check its Response. If it shows HTML or an error message, the path is wrong. Fix the path in _Layout.cshtml and the file should load.
After you fix the paths, do a hard refresh (Ctrl+F5) to clear cached scripts. The console errors should be gone, and the Read, Create, Update, and Destroy actions should start firing. In case the issue continues to perists, please send us the Grid configuration used on your side and mroe details about the project set up.
I hope this helps.
Regards,
Neli
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
Hi Rupert,
Thank you for sharing your experience and highlighting the importance of keeping the browser up to date. I’m glad updating your browser resolved the issues you encountered.
We appreciate you sharing your suggestions with the community, as they may help others experiencing similar behavior.
Regards,
Neli