GridViewExtension.GetBatchDeleteKeys<T>() Method
Returns a list of keys that correspond to grid records deleted on the client side in batch edit mode.
Namespace: DevExpress.Web.Mvc
Assembly: DevExpress.Web.Mvc5.v24.1.dll
NuGet Package: DevExpress.Web.Mvc5
Declaration
Type Parameters
Name |
---|
T |
Returns
Type | Description |
---|---|
List<T> | A List<T> object that stores the list of keys. |
Remarks
...
public ActionResult BatchUpdateAction() {
List<string> keysToInsert = GridViewExtension.GetBatchInsertValues<string>(Data.Table.Columns[0].ColumnName);
...
foreach (DataColumn column in Data.Table.Columns) {
var newValues = GridViewExtension.GetBatchUpdateValues<string, string>(column.ColumnName);
if (newValues != null) {
Data.UpdateColumn(column.ColumnName, newValues);
}
...
var insertValues = GridViewExtension.GetBatchInsertValues<string>(column.ColumnName);
if (insertValues != null) {
Dictionary<string, string> dictionary = keysToInsert.ToDictionary(x => x, x => insertValues[keysToInsert.IndexOf(x)]);
Data.UpdateColumn(column.ColumnName, dictionary);
}
}
...
var deleteValues = GridViewExtension.GetBatchDeleteKeys<string>();
if (deleteValues != null)
Data.RemoveRows(deleteValues);
...
}
See Also