【发布时间】:2015-07-04 14:19:20
【问题描述】:
我有一个带有产品选择的标准订单表。我正在创建一个下拉列表,其中 ProductName 和 ID 是 Product 参考数据模型的属性。 ProductID 是 Order 模型的一个属性。 提交表单时,下拉列表已加载并正常工作。
我的问题是当用户再次打开此表单以查看他的订单时。我从数据库加载 Order 模型,我可以看到 ProductID 已正确加载回来。但是,下拉选择保持空白。这是标准行为吗?也许我需要执行一些额外的任务。 kendo ui 不会自动翻译产品 ID 以在下拉列表中显示产品名称吗?
@model int
@(Html.Kendo().DropDownList()
.Name("ProductID")
.OptionLabel(" ")
.DataTextField("ProductName")
.DataValueField("ID")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("RefDataClientSelection_Read", "RefDataClient").Type(HttpVerbs.Post); //Set the Action and Controller name
})
.ServerFiltering(true); //If true the DataSource will not filter the data on the client.
})
)
【问题讨论】:
标签: javascript kendo-ui kendo-asp.net-mvc telerik-mvc