2

我有一个剑道网格:

@(Html.Kendo().Grid<Grid>().Name("Grid")
      .DataSource(ds => ds
          .Ajax()
          .Model(model => model.Id(m => m.ID))
          .Read(read => read.Action("Grid_Read", "Sessions", new {sessionId = ViewBag.SessionID}))
              .Update(update => 
update.Action("Grid_Update", "Sessions", new { 
sessionId = ViewBag.SessionID, qcStateId = '????'}))
              .PageSize(10)
              .Batch(true)
          )
          .ToolBar(toolbar => 
          {
              toolbar.Template(
                    "| Set selected to: " + @Html.Partial("EditorTemplates/QCStatusHeader"));
          }
          )

QCStatus 标头:

@(Html.Kendo().DropDownList()
    .Name("QCStatusHeader")
    .DataValueField("Id")
    .DataTextField("Name")
    .BindTo((List<NomadBase.Web.ViewModels.Shared.QCStateViewModel>)ViewBag.PossibleQCStatesHeader)

)

如何从 QCStatusHeader 下拉列表中获取所选值到我对控制器的更新调用中?

4

1 回答 1

3

非常简单的解决方案,使用 javascript 方法添加 .Data 选项以返回当前选择的 ddl 值。

.Update(update => update.Action("Grid_Update", "Sessions", new {sessionId = ViewBag.SessionID})
    .Data("QCStatusHeaderValue"))

function QCStatusHeaderValue() {
        var value = $('#QCStatusHeader').data("kendoDropDownList").value();
        return { qcStateId: value };
    }
于 2014-08-13T19:29:39.107 回答