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.v19.2.dll

Declaration

public static Dictionary<S, T> GetBatchUpdateValues<S, T>(
    string fieldName
)
Public Shared Function GetBatchUpdateValues(Of S, T)(
    fieldName As String
) As Dictionary(Of S, T)

Parameters

Name Type Description
fieldName String

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

Returns

Type Description
Dictionary<S, T>

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

Type Parameters

Name Description
S
T

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