C# MVC剑道网格将dropdownlist值传递到更新方法
我有剑道格网:C# MVC剑道网格将dropdownlist值传递到更新方法,c#,asp.net-mvc,kendo-ui,kendo-grid,kendo-dropdown,C#,Asp.net Mvc,Kendo Ui,Kendo Grid,Kendo Dropdown,我有剑道格网: @(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.Sessi
@(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"));
}
)
@(Html.Kendo().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(更新=>
行动(“网格更新”,“会话”,新{
sessionId=ViewBag.sessionId,qcStateId='??'})
.页面大小(10)
.Batch(真)
)
.ToolBar(ToolBar=>
{
工具栏.模板(
|将所选设置为:“+@Html.Partial”(“EditorTemplates/QCStatusHeader”);
}
)
QCStatusHeader:
@(Html.Kendo().DropDownList()
.Name("QCStatusHeader")
.DataValueField("Id")
.DataTextField("Name")
.BindTo((List<NomadBase.Web.ViewModels.Shared.QCStateViewModel>)ViewBag.PossibleQCStatesHeader)
@(Html.Kendo().DropDownList())
.Name(“QCStatusHeader”)
.DataValueField(“Id”)
.DataTextField(“名称”)
.BindTo((列表)ViewBag.PossibleQCStatesHeader)
)
如何将从QCStatusHeader下拉列表中选择的值输入到控制器的更新调用中?非常简单的解决方案,使用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 };
}
我在我的地图上添加了一个参数图,并从中读取下拉列表的值。差不多6年后,我需要这个。多亏了你和OP!!