saedbfd saedbfd - 11 months ago 100
ASP.NET (C#) Question

How to use kendo-ui mvc in visual studio 2015?

I want to use kendo-ui mvc in visual studio 2015. I install telerik package and the kendo-ui added to my visual studio.

I create a new kendo-ui mvc project. When i open index.cshtml file and write


the inheritence dose not show Kendo() method and i cant use it.
How can i create Controls such as a DatePicker in kendo-ui 2016 and visual studio 2015?

Answer Source

The first thing to check when you don't see something in the intellisense, is your project "References". It is the only place the compiler looks to find the used libraries. In your case you need a reference to Kendo.Mvc.dll as described here.

Next, it's worth noting that Html.Kendo() is an "Extension Method" and is simply a shorthand for Kendo.Mvc.UI.HtmlHelperExtension.Kendo(Html). So, when you have the required reference, the latter form should work; But to be able to use the shorter form, you need to import the Kendo.Mvc.UI namespace in your cshtml file. There are two ways to do this:

  • Add @using Kendo.Mvc.UI to the top of the cshtml file, or
  • Add this line: <add namespace="Kendo.Mvc.UI"/> to the namespaces section in Views\web.config in your project. This imports the namespace for every cshtml file under the Views folder, but you might need to reload the project for this to work.

Anyway, please follow this guide to be sure you won't forget anything.