Skip to main content

GridViewExtension.GetBatchUpdateValues<S, T>(String) Method

Returns a dictionary containing record keys and new values updated in the specified column 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

public static Dictionary<S, T> GetBatchUpdateValues<S, T>(
    string fieldName
)

Parameters

Name Type Description
fieldName String

A String value that specifies the name of the data source field or a model property.

Type Parameters

Name
S
T

Returns

Type Description
Dictionary<S, T>

A Dictionary<TKey,TValue> object that stores the record keys and new values.

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