我在这里关注了它,https://www.devexpress.com/Support/Center/Example/Details/E5116并在 ASP.NET MVC 中应用了给定的示例。以下是我的gridview设置示例部分代码:
settings.SettingsEditing.Mode = GridViewEditingMode.Batch;
settings.SettingsEditing.BatchEditSettings.EditMode = GridViewBatchEditMode.Row;
settings.CellEditorInitialize = (s, e) =>
{
ASPxGridView grid = s as ASPxGridView;
ASPxEdit editor = (ASPxEdit)e.Editor;
if (e.Column.FieldName == "columnName1" || e.Column.FieldName == "columnName2")
{
e.Editor.ReadOnly = !grid.IsNewRowEditing;
}
};
现在我不能在更新现有行数据的同时编辑两个单元格,这看起来很完美。
但我无法在使用新按钮创建新行时编辑两列。
注意:-它在以下情况下工作:
settings.SettingsEditing.Mode = GridViewEditingMode.Inline;
但在编辑模式为Batch时不起作用。