【发布时间】:2012-09-13 16:04:21
【问题描述】:
假设我在 /Views/Home/Index.cshtml 上的文件上有网格:
@model IEnumerable<KendoMVCWrappers.Models.StockWebAndDetailsView>
@( Html.Kendo().Grid(Model)
.Name("Grid")
@* Other columns and dataSource in here *@
columns.Bound("QuantityToEnquiry").Filterable(false).Sortable(false)
.EditorTemplateName("QuantityToEnquiry");
})
我在 /Views/EditorTemplateName/QuantityToEnquiry.cshtml 上有文件(我也试过 ~/Views/Shared/EditorTemplates/):
@(Html.Kendo().ComboBox()
.Name("QuantityToEnquiry")
.Value("1")
.BindTo(Enumerable.Range(1, 100).ToList())
在我拥有的模型上:
public class StockWebAndDetailsView
{
[UIHint("QuantityToEnquiry")]
public int QuantityToEnquiry { get; set; }
}
显示的数据是null,一个值为“null”的字符串,我不知道为什么。
【问题讨论】:
-
“显示的数据为空”是什么意思?它在下拉列表中吗?使用 Html.DropDownList 时会发生什么?
-
嗨@AtanasKorchev 它输出一个空字符串,而不是一个组合框。
-
在这种情况下 Html.DropDownList 输出什么?
-
同样的输出,好像没有找到文件
-
你的属性是用 UIHint 属性装饰的吗?除非您使用 UIHint 指定编辑器模板的名称,否则 ASP.NET MVC 将找不到它。
标签: telerik-grid telerik-mvc kendo-ui