Kendo UI reference not working in Razor view

后端 未结 10 2343
感情败类
感情败类 2021-02-19 09:10

I am trying to create a Telerik Grid view but when I go to reference kendo it does not recognize it. Visual Studio is giving me an error when I try to reference kendo. This is t

相关标签:
10条回答
  • 2021-02-19 09:48

    I had the same problem. The third point mentioned below solved the problem in my case.

    1. Include the JavaScript and CSS files: The ordering of scripts and css files is also very important. jQuery should be included before the KendoUI script file(s).

    2. Add reference to Kendo.Mvc.dll: Right-click the References node in Solution Explorer and click Add Reference. Select the Browse tab of the Add Reference dialog and navigate to the install location of Telerik UI for ASP.NET MVC.

    3. Update the web.config in Views folder: Open Views/Web.config (or root Web.config if using ASPX). Locate the namespaces tag. Append an below add tag to the namespaces tag.

    <add namespace="Kendo.Mvc.UI" />
    
    0 讨论(0)
  • 2021-02-19 09:48

    Regarding the addition of Kendo into existing ASP Core application, I did find that adding css and javascript (js) file references into my _Layout.cshtml anywhere other than before <environment> tags in the <head> caused an issue. I did eventually get this to work by adding the following:

    <link href="https://kendo.cdn.telerik.com/2017.2.621/styles/kendo.common-material.min.css" rel="stylesheet" type="text/css" />
    <link href="https://kendo.cdn.telerik.com/2017.2.621/styles/kendo.mobile.all.min.css" rel="stylesheet" type="text/css" />
    <link href="https://kendo.cdn.telerik.com/2017.2.621/styles/kendo.material.min.css" rel="stylesheet" type="text/css" />
    
    <script src="https://kendo.cdn.telerik.com/2017.2.621/js/jquery.min.js"></script>
    <script src="https://kendo.cdn.telerik.com/2017.2.621/js/jszip.min.js"></script>
    <script src="https://kendo.cdn.telerik.com/2017.2.621/js/kendo.all.min.js"></script>
    <script src="https://kendo.cdn.telerik.com/2017.2.621/js/kendo.aspnetmvc.min.js"></script>
    
    0 讨论(0)
  • 2021-02-19 09:48

    However, I had the same problem but it was solved after the following steps:

    1- Open tools ==> Extensions and updates
    2- Tap on the "Online" tab on the left and search for telerik
    3- Download and install "Telerik ASP.NET AJAX VSExtensions" & "Telerik ASP.NET MVC VSExtensions"
    4- Close the Window
    5- Go to "Telerik" tab
    6- Tap on "Telerik UI for ASP.NET MVC"
    7- Upgrade Wizard and upgrade

    This solved the problem because of the conflict between Telerik versions between two stations. in addition to the fact that kendo is not included in the project if you installed VS after you do for Telerik.

    0 讨论(0)
  • 2021-02-19 09:51

    When you created your project you had to have selected the right project type. There is the Telerik asp.net MVC application project type and the Kendo UI Asp.net MVC 5 project type. Picking the Kendo UI project type will provide you with the javascript kendo classes. This is for when you want to use Kendo through javascript, I had the same issue until I went back and chose the right project type. I spent a day and a half trying to add the .net class libraries because my razor wouldn't work. I think Visual studio was just confused about what I was trying to do and I probably was missing a .net class library.

    0 讨论(0)
提交回复
热议问题