我目前正在尝试评估Kendo UI ASP.NET mvc 6(“ASP.NET核心”)小部件。我下载了示例项目kendo.mvc.examples项目,可以在以下站点找到:http://docs.telerik.com/kendo-ui/aspnet-mvc/aspnetmvc-apps/mvc-6/introduction
示例项目运行良好。现在我正在尝试创建自己的骨架项目如下:
>
“kendo.mvc”:“2016.1.301”
依赖项。Startup.ConfigureReservices()
Services.AddKendo();
修改了my index.chtml以包含Kendo UI控件:
@使用kendo.mvc.ui
@{viewdata[“title”]=“My Things Dashboard”;}
当前正在运行的东西
@(html.kendo().button().name(“icontextbutton”).htmlattributes(new{type=“button”}).icon(“取消组”).content(“kendo UI button”))
@(html.kendo().chart().name(“chart”).title(“Gross Dispont product Growt\n/GDP年度%/”).legend(legend=>legend.position(chartlegendPosition.bottom)).chartArea(chartArea=>chartArea.background(“transparent”)).seriesDefaults(seriesDefaults=>seriesDefaults.area().line(line=>line.style(chartlinestyle.smooth)).}).CategoryAxis(axis=>axis.Categories(“2002”、“2003”、“2004”、“2005”、“2006”、“2007”、“2008”、“2009”、“2010”、“2011”).MajorGridLines(lines=>lines.Visible(false)).ValueAxis(axis=>axis.Numeric().labels(labels=>labels.Format(“{0}%”)).AxisCrossingValue(-10).line(line=>lines.Visible(false)).tooltip(tooltip=>
当我运行应用程序时,按钮显示正确,但图表没有出现。但是,查看html源代码,我可以看到正在生成图表:
当前正在运行的东西
剑道UI按钮jQuery(function(){jQuery(“#icontextButton”).kendoButton({“icon”:“ungroup”});});
<div id="chart" name="chart"></div><script>jQuery(function(){jQuery("#chart").kendoChart({"categoryAxis":[{"categories":["2002","2003","2004","2005","2006","2007","2008","2009","2010","2011"],"majorGridLines":{"visible":false}}],"chartArea":{"background":"transparent"},"legend":{"position":"bottom"},"series":[{"name":"India","type":"area","data":[3.907,7.943,7.848,9.284,9.263,9.801,3.89,8.238,9.552,6.855]},{"name":"World","type":"area","data":[1.988,2.733,3.994,3.464,4.001,3.939,1.333,-2.245,4.339,2.727]},{"name":"Haiti","type":"area","data":[-0.253,0.362,-3.519,1.799,2.252,3.343,0.843,2.877,-5.416,5.59]}],"title":{"text":"Gross domestic product growth \n /GDP annual %/"},"tooltip":{"format":"{0}%","template":"#= series.name #: #= value #","visible":true},"valueAxis":[{"axisCrossingValue":[-10],"labels":{"format":"{0}%"},"line":{"visible":false},"type":"numeric"}],"seriesDefaults":{"area":{"line":{"style":"smooth"}}}});});</script>
不知道我做错了什么...谢谢你的帮助!
OK通过以下Telerik疑难解答链接解决了该问题:http://docs.Telerik.com/kendo-ui/troubleshoot/troubleshooting-common-issues#kendo-ui-widgets-are-unavailable-or-undefined
jquery是在页面中的剑道ui脚本之后引用的。确保在kendo ui之前包含jquery