Click here to Skip to main content
15,942,847 members
Articles / Web Development / HTML

Kendo Grid Editable Column with DropDown

Rate me:
Please Sign up or sign in to vote.
4.00/5 (2 votes)
6 Dec 2014CPOL2 min read 93K   2.5K   10   4
How to add dropdown inside Editable Kendo Grid

This article appears in the Third Party Products and Tools section. Articles in this section are for the members only and must not be used to promote or advertise products in any way, shape or form. Please report any spam or advertising.


This tip shows how we can add Editable Template inside a Kendo Grid Column. Technology included ASP.NET MVC, jQuery and Kendo Controls.


Recently, we faced this challenge in our business application, where we needed Grid Column Editable, but what type of value user can choose depends on XML configuration - more specifically depends on User Name and values in other Grid Column.

Here is how my Grid looks like:

Using the Code

Binding Kendo Grid with Model data in MVC is straightforward (Refer to the attached file for more).

Jumping to the next step, we made one column editable in Grid.

My Model Class consumes XML data.

<?xml version="1.0" encoding="utf-8" ?>
  <PropertyType Name="Pressure" 
  Value="psia,bara" SelectedValue="psia"></PropertyType>
  <PropertyType Name="Temperature" 
  Value="degF,degC" SelectedValue="degF"></PropertyType>
  <PropertyType Name="Viscosity" 
  Value="cP" SelectedValue="cP"></PropertyType>
  <PropertyType Name="Density" 
  Value="lb/ft3,kg/m3" SelectedValue="lb/ft3"></PropertyType>

We added one Read-Only property in Model class - AvailableValues. This will just return List of Values to be displayed in DropDown and mapped with Value attribute in XML above.

public List<string> AvailableValues
                if (!string.IsNullOrEmpty(Value))
                    return Value.Split(',').ToList();

                return null;

Here is our MVC Grid. We bound "Parameter" column with AvailableValues and ClientTemplate should display SelectedValue property.

                .Columns(columns =>
                    columns.Bound(p => p.Name).Title("Key").Width(60);
                    columns.Bound(p => p.AvailableValues)
                .Editable(editable => editable.Mode(GridEditMode.InCell))
                .Scrollable(scr => scr.Height(140))
                .DataSource(dataSource => dataSource.Ajax()
                    .Model(model =>
                        model.Id(p => p.Name);
                        model.Field(p => p.Name).Editable(false);
                        model.Field(p => p.AvailableValues).Editable(true);

We used EditorTemplateName as "AvailableValues". This we declared inside Views/Shaed/EditorTemplated in MVC structure.

@using Kendo.Mvc.UI

.DataSource(d => d.Read(r => r.Action
("GetTypes", "Home").Data("getParentID()")))
.Events(e =>

Problem with Editable dropdown is it cannot read client side data available inside "AvailableValues". So using MVC, we are calling Controller method "GetTypes". It will receive "AvailableValues" list and return JSON to bind with DropDown. This call will happen only when user clicks on Editable column, aka try to change values.

getParentID() is a JavaScript function used to pull data of available values from Kendo Grid Column.

A small trick I used to apply the Selected Value in Drop Down to be applied on Grid Column on DropDown selection change.

var dataItem; //This should be Global variable
function getParentID() {
    var row = $(event.srcElement).closest("tr");
    var grid = $(event.srcElement).closest("[data-role=grid]").data("kendoGrid");
    dataItem = grid.dataItem(row);
    var arr = [];
    $(dataItem.AvailableValues).each(function () {
    return { values: arr };

function onSelect(e) {
    var selectedValue = this.dataItem(e.item.index()).Value;
    if (dataItem != null) {
        dataItem.SelectedValue = selectedValue;

Please refer to the attached for entire code.

Please feel free to raise any problem/concern/query.

Points of Interest

Kendo controls are relatively new to me and I am looking forward to exploring more tricks.


  • 6th December, 2014: Initial version


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
Technical Lead Wipro
India India
I am working as .NET developer for around 9 Years now. I have 4 years+ experience in WPF desktop application and WCF service. Recently I have started exploring AngularJS, HTML5 and Kendo controls.

Comments and Discussions

Questionevent is not defined Pin
Member 1105936420-Jun-17 23:59
Member 1105936420-Jun-17 23:59 
GeneralMy vote of 5 Pin
Dan Randolph24-Mar-15 12:49
Dan Randolph24-Mar-15 12:49 
QuestionKendo Grid Editable Column with DropDown , Pin
Er. Pradeep Kumar Rai13-Jan-15 21:29
Er. Pradeep Kumar Rai13-Jan-15 21:29 
AnswerRe: Kendo Grid Editable Column with DropDown , Pin
ArindamSarkar20-Mar-15 8:34
professionalArindamSarkar20-Mar-15 8:34 
Sorry for the delay in response. Hope your problem already resolved.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.