Q:

Adding dropdown menu to Kendo UI grid in editing mode - C# MVC

Here is what my grid looks like:
@(Html.Kendo().Grid(Model).Name("Short-Grid").TableHtmlAttributes(new { @class = "short-duration-grid" })
      .Columns(col =>
      {

          //Commands btn
          col.Command(command =>
          {
              command.Edit().HtmlAttributes(new { title = "Assign Analyst" }).CancelText("");
              command.Custom("Close").HtmlAttributes(new { title = "Close Attack" });

          });

          col.Bound(c => c.SDHandledBy).Title("User");
    })
    .Editable(editable => editable.TemplateName("AttackViewModel").Mode(GridEditMode.InLine))
    .Scrollable(o => o.Height(height))
    .HtmlAttributes(new { style = "height:700px;" })
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(20)
        .Events(events => events.Error("error_handler"))
        .Model(model => model.Id(o => o.AttackID))
        .Model(model => model.Field(f => f.SDHandledBy).Editable(true))
        .Create(update => update.Action("EditingInline_Create", "Grid"))
        .Update(update => update.Action("Update", "ShortDuration"))
        .Read(read => read.Action("EditingInline_Read", "Grid"))
        .Destroy(update => update.Action("EditingInline_Destroy", "Grid"))

    )        
        .Sortable()
        .Groupable()
        .Filterable()
)

I'm trying to add dropdown menu in edit mode to "User" column.
I have the relevant data of users in viewbag.
How can I change the code, and make this column to be displayed as dropdown with data from viewbag?
Is it possible? If not, please help me and explain what is the best way to do it.

A:

Create a view in ~/Views/Shared/EditorTemplates and name it say... Users
@using System.Collections
@using Kendo.Mvc.UI

@(Html.Kendo().DropDownList()
 .BindTo((IEnumerable)ViewBag.Users)
 .OptionLabel("... Select User ... ")
 .DataValueField("UserId")
 .DataTextField("UserName")
 .Name("UserId")
 )

And use this view as EditorTemplate
 columns.Bound(c => c.SDHandledBy).EditorTemplateName("Users")
        .Title("Users").ClientTemplate("#:UserName#");

And add UserName in your DTO(Assumed that SDHandledBy is type of GUID)

