我有一个KendoUI下拉列表,如下所示:
@(Html.Kendo().DropDownList()
.Name("DeviceInterfaces")
.OptionLabel("Select interface...")
.DataTextField("Name")
.DataValueField("Id")
.DataSource(source => source.Read(read => read.Action("GetCascadeDeviceInterfaces", "EventTriggers")))
)
这是一个级联下拉列表,如何将用户选择的任何内容设置为模型的属性?
没
关系,我找到了方法。
我必须使用 DropDownListFor 而不是 DropDownList,再加上 .名称属性必须与模型的 Id 匹配。
@(Html.Kendo().DropDownListFor(m => m.EventTrigger.TriggerType)
.Name("EventTrigger.EventType")