Kendo UI Scripts没有捆绑在MVC5中

时间:2016-05-10 22:40:02

标签: javascript kendo-ui asp.net-mvc-5 kendo-asp.net-mvc

我正在为ASP.NET MVC使用kendo UI。我已经捆绑了所有的剑道JS文件。在当地它的工作正常。但是,当我将应用程序部署到Web服务器,然后当我浏览页面时,我注意到kendo javascripts没有捆绑,因此我收到错误

  

未捕获TypeError:jQuery(...)。kendoDropDownList不是函数

这是我捆绑文件的方式 Bundled Files

这就是我在_Layout.cshtml中引用它们的方式

@echo off
title Clean Up Desktop & rem // (this is the window title, just for fun)
color 0E
pushd "%USERPROFILE%\Desktop" || exit /B 1 & rem // (the command after `||` runs if `pushd` fails, when the dir. is not found)
rem /* Here you can see how to distinguish between files and directories;
rem    files are deleted with `del`, directories are removed with `rd`.
rem    The upper-case `ECHO`s are there for testing purposes only;
rem    remove them as soon as you actually want to delete any items: */
forfiles /C "cmd /C if @isdir==FALSE (if /I not @ext==\"lnk\" ECHO del /F /Q @relpath) else ECHO rd /S /Q @relpath"
pause
popd & rem // (this restores the previous working directory)
exit /B & rem // (this quits the batch file only; not necessary at the end of the script)

这就是我在浏览器中看到的F12 - >来源标签

enter image description here

请注意,jQuery,Modernizer和Bootstrap是捆绑的,但不是kendo。为什么呢?

1 个答案:

答案 0 :(得分:0)

所以最后它开始工作..我已经跟着telerik的文章here 这篇文章与我正在做的唯一区别 是:

项目中的JS文件位置:我是$nbPage = 42; $actualPage = 23; $min_part_pagination = floor($actualPage / 10)*10; $max_part_pagination = ceil($actualPage / 10 )*10; $last_part_pagination = floor($nbPage /10 )*10; $first_part_pagination = 10; $count = 1; for($j = 1 ; $j <= $nbPage ; $j++){ if($j % 10){ if($pageActuelle == $count){ $max_part_pagination = ($max_part_pagination < $nbPage) ? $max_part_pagination : $nbPage+1; for($k = $min_part_pagination+1 ; $k < $max_part_pagination ; $k++ ){ if($k == 1){ echo "<a href=http://dev.blablabl.fr/public_html/>".$k."</a> "; }else{ echo "<a href=http://dev.blablabl.fr/public_html/page/".$k.">".$k."</a> "; } } } elseif($count == $nbPage && $pageActuelle < $last_tranche_pagination ){ echo "<a href=http://dev.blablabl.fr/public_html/page/".$count.">".$count."</a> "; }elseif($count == 1 && $pageActuelle >= $first_tranche_pagination ){ echo "<a href=http://dev.blablabl.fr/public_html/>1</a> "; } }else{ if($pageActuelle == $count){ if($max_part_pagination == $max_part_pagination ){ $max_part_pagination += 10; }else{ $max_part_pagination = $last_tranche_pagination; } echo 'min_part_pagination > '.$min_part_pagination.'<br />'; echo 'max_part_pagination > '.$max_part_pagination.'<br />'; for($k = $min_part_pagination ; $k < $max_part_pagination ; $k++){ echo "<a href=http://dev.blablabl.fr/public_html/page/".$k.">".$k."</a> "; } }else{ echo "<a href=http://dev.blablabl.fr/public_html/page/".$count.">".$count."</a> "; } } 并建议~/Scripts/kendo/2016.1.412
项目中的CSS文件位置:我的是~/Sripts/kendo并建议~/Content/kendo/2016.1.412

同样在BundleConfig.cs文件中 JS Bundle脚本名称:我是~/Content/kendo并建议~/bundles/kendo/2016.1.412
CSS Bundle脚本名称:我是~/bundles/kendo并建议~/Content/kendo-bootstrap/css

我不知道为什么会有所作为,因为最终我在layout.cshtml中引用了正确的包名称

但无论如何,上述变化对我有用