如何在JQGrid中编辑/搜索字段中设置默认值(使用MVC版本)?
答案 0 :(得分:2)
设置DropDown的默认值
new JQGridColumn
{
DataField = "myField",
DataType = typeof(string),
Editable = true,
EditType = EditType.DropDown,
EditFieldAttributes = new List<JQGridEditFieldAttribute>()
{
new JQGridEditFieldAttribute(){ Name = "defaultValue", Value = "myDefaultValue"},
},
},
设置TextBox的默认值
new JQGridColumn
{
DataField = "myField",
DataType = typeof(string),
Editable = true,
EditFieldAttributes = new List<JQGridEditFieldAttribute>()
{
new JQGridEditFieldAttribute(){ Name = "value", Value = "myDefaultValue"},
},
},
默认CheckBox要检查
new JQGridColumn
{
DataField = "myField",
DataType = typeof(bool),
Editable = true,
EditType.CheckBox,
EditFieldAttributes = new List<JQGridEditFieldAttribute>()
{
new JQGridEditFieldAttribute(){ Name = "checked", Value = "checked"},
},
},