Kendo MVC DropDownListFor 没有将所选值绑定到模型

Kendo MVC DropDownListFor does not bind selected value to model

@(Html.Kendo().DropDownListFor(model => model.ServiceID)
  .OptionLabelTemplate("#=optionLabel#")
  .ValueTemplate("#=Code#(#=Rate#) - #=Description#")
  .Template("#=Code#(#=Rate#) - #=Description#")
  .DataTextField("Code")
  .DataValueField("ServiceID")
  .DataSource(d =>
  {
    d.Read(read =>
    {
      read.Action("GetServiceRepository", "Service").Type(HttpVerbs.Post);
    });

  })
  .Events(e => e.Change("onWorkOrderJobServiceChange"))
  .HtmlAttributes(new { required = "required" })
  .OptionLabel(new { optionLabel = Resources.Wording.SelectOne, ServiceID = 0, Rate = 0, Code = "", Description = "" })
)

我有一个如上所述的下拉列表,我想将 selected 值绑定到模型的 ServiceID 字段(类型为 int

但是,无论我select是哪一项,ServiceID字段总是空的!它甚至不是可空类型 int?!

为什么会这样,我怎样才能实现我想要的目标?

Kendo DropDownList 有 ValuePrimitive。默认情况下,它是 false,并且选择了项目 returns 文本和值对。

@(Html.Kendo().DropDownListFor(model => model.ServiceID)
  .ValuePrimitive(true)
  ....