0

如何在 JQGrid 的编辑/搜索字段中设置默认值(使用 MVC 版本)?

4

1 回答 1

2

设置下拉菜单的默认值

new JQGridColumn
{ 
   DataField = "myField",
   DataType = typeof(string),
   Editable = true,
   EditType = EditType.DropDown,
   EditFieldAttributes = new List<JQGridEditFieldAttribute>()
   {                                     
      new JQGridEditFieldAttribute(){ Name = "defaultValue", Value = "myDefaultValue"},
   },
},

设置文本框的默认值

new JQGridColumn
{ 
   DataField = "myField",
   DataType = typeof(string),
   Editable = true,
   EditFieldAttributes = new List<JQGridEditFieldAttribute>()
   {                                     
      new JQGridEditFieldAttribute(){ Name = "value", Value = "myDefaultValue"},
   },
},

将复选框默认为选中

new JQGridColumn
{ 
   DataField = "myField",
   DataType = typeof(bool),
   Editable = true,
   EditType.CheckBox,
   EditFieldAttributes = new List<JQGridEditFieldAttribute>()
   {                                     
     new JQGridEditFieldAttribute(){ Name = "checked", Value = "checked"},
   },
},
于 2012-12-17T15:15:31.333 回答