-1

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

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

@{Html.Kendo().DatePicker().Name...}

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?

saedbfd
  • 39
  • 2
  • 9

2 Answers2

1

Check your Views\Web.config. It should have like:

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

or add @using Kendo.Mvc.UI to index.cshtml

Roman Marusyk
  • 23,328
  • 24
  • 73
  • 116
0

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.

mrmashal
  • 1,721
  • 18
  • 21