[英]How do I bind the selected value of a kendoui dropdownlist to my model?
I have a KendoUI dropdownlist as follows: 我有一个KendoUI下拉列表如下:
@(Html.Kendo().DropDownList()
.Name("DeviceInterfaces")
.OptionLabel("Select interface...")
.DataTextField("Name")
.DataValueField("Id")
.DataSource(source => source.Read(read => read.Action("GetCascadeDeviceInterfaces", "EventTriggers")))
)
It's a cascading dropdownlist, how do I set whatever the user selects to the property of my model? 这是一个级联下拉列表,如何设置用户选择的模型属性?
It's ok, I found out how to. 没关系,我发现了怎么做。
I have to use DropDownListFor instead of DropDownList, plus the .Name property has to match the Id of the model. 我必须使用DropDownListFor而不是DropDownList,加上.Name属性必须匹配模型的Id。
@(Html.Kendo().DropDownListFor(m => m.EventTrigger.TriggerType)
.Name("EventTrigger.EventType")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.