Add DropDownList as column in KendoUI grid

950 views Asked by At

I'm working with KendoUI and MVC 5

I have a server-side model like this

public class ApplicationModel
{
    public int Id { get; set; }
    public string Name { get; set; }
    public ApplicationVersionModel MinVersion { get; set; }
    public ApplicationVersionModel CurrentVersion { get; set; }
    public IEnumerable<ApplicationVersionModel> Versions { get; set; }
}

with ApplicationVersionModel set up like this

public class ApplicationVersionModel
{
    public int Id { get; set; }

    public string Number { get; set; }
}

I'd like to build a grid using KendoUI with a possibility to perform an inline edit with DropDownList for my MinVersion and CurrentVersion fields. Example grid on the Telerik's website uses static data source for each row's dropdown while I need to bind each row to it's Versions property.

UPDATE:

Model is IEnumerable<ApplicationModel>

@(Html.Kendo().Grid(Model)
  .Name("grid")
  .Columns(columns =>
  {
      columns.Bound(p => p.Name);
      columns.ForeignKey(p => p.CurrentVersion, (System.Collections.IEnumerable)ViewData["something"], "Id", "Number");
  })

I need somehow to tell my grid that datasource is p => p.Versions instead of ViewData["something"]. Each row (ApplicationModel) has it's own list of versions in my case. Can't find necessary overload for this

0

There are 0 answers