Kendo UI in ASP.NET MVC 3 applications
This tutorial shows how to use Kendo UI Complete for ASP.NET MVC in ASP.NET MVC 3 applications. The tutorial uses Visual Studio 2010 but will work with all Visual Studio versions that support ASP.NET MVC 3. The tutorial also creates a new ASP.NET MVC 3 application but the steps to use Kendo UI in exsiting ASP.NET MVC 3 application are the same.
The Kendo UI Visual Studio extensions automate the whole procedure which this document describes.
To create a new ASP.NET MVC 3 Application follow these steps.
- Open Visual Studio 2010.
- Press CTRL+SHIFT+N to create a new project.
- Select the Visual C# node and then Web to show all available web project templates for C#.
- Select ASP.NET MVC 3 Web Application and click OK. This will start the New ASP.NET MVC 3 Project wizard.
- Select Internet Application from the available templates and click OK. Alternatively you can select other templates - the remaining steps are the same.
- Press CTRL+F5 to build and run the application.

To use Kendo UI Complete for ASP.NET MVC you need to include the required JavaScript and CSS files, reference the Kendo.Mvc.dll assembly and update the web.config file of the application.
Kendo UI requires certain JavaScript and CSS files to be included in the page. There are two options - either to include a local copy of those files or to use Kendo UI CDN (Content Delivery Network).
Using local JavaScript and CSS
To copy the Kendo UI JavaScript and CSS files in the Visual Studio Solution of the application follow these steps.
- Navigate to the install location of Kendo UI Complete for ASP.NET MVC. By default it is in *C:\Program Files (x86)\Telerik*.
- Copy the js directory from the install location and paste it in the Scripts folder of the application.
- Copy the styles directory from the install location and paste it in the Content folder of the application.
- Rename the Scripts/js directory to Scripts/kendo. Rename Content/styles to Content/kendo.

After the Kendo UI JavaScript and CSS files are added in the application you can include them.
- Open the layout of the application. By default it is Views/Shared/_Layout.cshtml (or Site.master if using ASPX).
Include Content/kendo/kendo.common.min.css and Content/kendo/kendo.default.min.css. Add a link tag within the head tag of the layout.
Razor
<link rel="stylesheet" href="@Url.Content("~/Content/kendo/kendo.common.min.css")" />
<link rel="stylesheet" href="@Url.Content("~/Content/kendo/kendo.default.min.css")" />
ASPX
<link rel="stylesheet" href="<%: Url.Content("~/Content/kendo/kendo.common.min.css") %>" />
<link rel="stylesheet" href="<%: Url.Content("~/Content/kendo/kendo.default.min.css") %>" />
Delete any existing script tags that include older versions of jQuery.
Include the jQuery JavaScript file distributed with Kendo UI or a compatible version from other location. Add a script tag in within the head tag of the layout.
Razor
<script src="@Url.Content("~/Scripts/kendo/jquery.min.js")"></script>
ASPX
<script src="<%: Url.Content("~/Scripts/kendo/jquery.min.js") %>"></script>
Include Scripts/kendo/kendo.all.min.js and Scripts/kendo/kendo.aspnetmvc.min.js after jQuery.
Razor
<script src="@Url.Content("~/Scripts/kendo/jquery.min.js")"></script>
<script src="@Url.Content("~/Scripts/kendo/kendo.all.min.js")"></script>
<script src="@Url.Content("~/Scripts/kendo/kendo.aspnetmvc.min.js")"></script>
ASPX
<script src="<%: Url.Content("~/Scripts/kendo/jquery.min.js") %>"></script>
<script src="<%: Url.Content("~/Scripts/kendo/kendo.all.min.js") %>"></script>
<script src="<%: Url.Content("~/Scripts/kendo/kendo.aspnetmvc.min.js") %>"></script>
Using Kendo UI CDN
To include the Kendo UI JavaScript and CSS files from CDN follow these steps. Important! Dont’t forget to replace "kendo ui version" from the code snippets below with the current version of Kendo UI e.g. “2013.2.918”.
- Open the layout of the application. By default it is Views/Shared/_Layout.cshtml (or Site.master if using ASPX).
Include kendo.common.min.css and kendo.default.min.css. Add a link tag within the head tag of the layout.
<link rel="stylesheet" href="http://cdn.kendostatic.com/<kendo ui version>/styles/kendo.common.min.css" />
<link rel="stylesheet" href="http://cdn.kendostatic.com/<kendo ui version>/styles/kendo.default.min.css" />
Delete any existing script tags that include older versions of jQuery.
Include the jQuery JavaScript file from Kendo CDN or a compatible version from other location. Add a script tag in within the head tag.
<script src="http://cdn.kendostatic.com/<kendo ui version>/js/jquery.min.js”></script>
Include kendo.all.min.js and kendo.aspnetmvc.min.js after jQuery.
<script src="http://cdn.kendostatic.com/<kendo ui version>/js/kendo.all.min.js”></script>
<script src=”http://cdn.kendostatic.com/<kendo ui version>/js/kendo.aspnetmvc.min.js”></script>
The next step is to add a reference to Kendo.Mvc.dll which is the assembly containing the Kendo UI server-side wrappers.
- 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 Kendo UI Complete for ASP.NET MVC.
- Navigate to wrappers/aspnetmvc/Binaries/MVC3. This directory contains the ASP.NET MVC 3 version of Kendo UI Complete for ASP.NET MVC.
- Select Kendo.Mvc.dll and click OK.
The next step is to let ASP.NET MVC know of the Kendo.Mvc.UI namespace where the server-side wrappers are. To do this update the web.config file of the web application.
- Open Views/Web.config (or root Web.config if using ASPX).
- Locate the namespaces tag.
Append an add tag to the namespaces tag.
<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>
Finally lets use a Kendo UI widget.
- Open the Views/Home/Index.cshtml view (or Index.aspx if using ASPX).
Add a Kendo UI DatePicker widget.
Razor
@(Html.Kendo().DatePicker().Name("datepicker"))
ASPX
<%: Html.Kendo().DatePicker().Name("datepicker") %>
Press CTRL+F5 to build and run the application.
