【发布时间】:2013-02-19 18:32:28
【问题描述】:
我想做什么:
我有一个带有 Kendo UI 控件的表单,例如页面前半部分的 DatePicker(s)、Dropdownlist(s)、NumericTextBox(s)
-
下半场有一个 Kendo UI MVC Grid 控件
- 此 Kendo UI Grid 控件有 8 列,其中 2 列具有 Kendo 下拉列表 (EditorTemplate) 和 CheckBox(EditorTemplate)。
- Kendo UI Grid 控件是 Ajax 绑定。
当单击保存按钮时,来自 Kendo UI 控件(前半部分)和 Kendo UI 网格控件(后半部分)的所有值一起作为 Json 对象通过“Ajax Post”发送到控制器。
我正在为上述过程使用模型绑定
问题或我面临的问题:
带有其他 Kendo UI 控件的表单的前半部分正在正确地将它们的值发布到控制器,但是由于 Kendo UI Grid 在发布某些列值时遇到了一些问题
Kendo UI Grid 中数据类型为小数的列未发布值
EditorTemplate 控件(如 CheckBox 和 kendo 下拉菜单)在选中时会显示下拉列表的值
"[Object Object]"以及布尔值而不是复选框控件的实际值。
【问题讨论】:
-
没有代码意味着几乎没有机会获得帮助。
-
你能添加一些代码吗?
-
@(Html.Kendo().Grid(Model.Products).Name("Products").Editable(editable => editable.Mode(GridEditMode.InCell)) .Columns(columns => { columns.Bound(p => p.Chk).ClientTemplate(""); columns.Bound(p => p.Account).EditorTemplateName("AccountList"); columns.Bound(p => p.ProductID).Hidden(); columns.Bound(p => p.Adjustment).Format("{0:C} "); columns.Bound(p => p.NewBalance).Format("{0:C}"); }) .DataSource(dataSource => dataSource.Ajax().Model(model => { model.Id( p => p.ProductID); }).ServerOperation(false)))
-
-
这是 EditorTemplate 代码:@(Html.Kendo().DropDownList() .Name("Account").DataTextField("Text") .DataValueField("Value").BindTo(new List
() { new SelectListItem() { Text = "Inv Type1", Value = "1" }, new SelectListItem() { Text = "Inv Type2", Value = "2" } }) .OptionLabel("选择") .SelectedIndex(0)
标签: asp.net-mvc user-interface grid kendo-ui