How to add Kendo UI HTML helpers to my ASP.net MVC 4 project?

血红的双手。 提交于 2019-12-30 10:26:22

问题


Simple question: I've installed Telerik DevCraft Ultimate on my workstation. I've looked at the examples showing the use of the Kendo UI HTML helpers.

What reference do I add to my project to be able to use them?


回答1:


Configure your ASP.NET MVC layout page to include the Kendo UI Web JavaScript and CSS files:

 <link rel="stylesheet" href="@Url.Content("~/Content/kendo.common.min.css")">
 <link rel="stylesheet" href="@Url.Content("~/Content/kendo.default.min.css")">
 <script src="@Url.Content("~/Scripts/jquery.min.js")"></script>
 <script src="@Url.Content("~/Scripts/kendo.web.min.js")"></script>
 <script src="@Url.Content("~/Scripts/kendo.aspnetmvc.min.js")"></script>

Add a reference to the Kendo.Mvc.UI namespace to your web.config. Then the Kendo HtmlHelper extension would be availble in your views. Rebuild your project after adding the namespace to the web.config (required for Visual Studio to show intellisense for Kendo.Mvc.UI).

<system.web.webPages.razor>
     <pages pageBaseType="System.Web.Mvc.WebViewPage">
         <namespaces>
             <add namespace="System.Web.Mvc" />
             <add namespace="System.Web.Mvc.Ajax" />
             <add namespace="System.Web.Mvc.Html" />
             <add namespace="System.Web.Routing" />
             <add namespace="Kendo.Mvc.UI" />
         </namespaces>
     </pages>
 </system.web.webPages.razor>

Use any Kendo UI HtmlHelper extension

@(Html.Kendo().DatePicker().Name("Birthday"))

more details at http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/introduction



来源:https://stackoverflow.com/questions/16046697/how-to-add-kendo-ui-html-helpers-to-my-asp-net-mvc-4-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!