The 'Specified method is not supported' and 'Updating is not supported by data source 'X' unless UpdateCommand is specified' errors occur
- 2 minutes to read
These errors may occur if you bind ASPxGridView to a custom data source at runtime and do not implement CRUD operations (such as INSERT, SELECT, UPDATE, and DELETE).
To resolve these errors, handle the following ASPxGridView events:
The BatchUpdate event if the control is in batch edit mode.
- Handle the BatchUpdate event.
- Get a data source.
- Use the e.InsertValues, e.UpdateValues, and e.DeleteValues collections to get the edited data.
- Update this data in the data source.
- Set the e.Handled property to
trueto cancel the default ‘Batch Update’ operation.
The RowInserting, RowUpdating, and RowDeleting events if the control is in any edit mode except batch.
Insert Row:
- Handle the RowInserting event.
- Get a data source.
- Create a new data item and fill its properties from the e.NewValues dictionary.
- Add this data item to the data source.
- Save the changes to the data source.
- Set the event’s e.Cancel property to
trueto close the edit form. - Call the CancelEdit() method to cancel the edit operation.
Update Row:
- Handle the RowUpdating event.
- Get a data source.
- Use the e.Keys property to get the edited data item from the data source.
- Edit the data item.
- Save the changes to the data source.
- Set the event’s e.Cancel property to
trueto close the edit form. - Call the CancelEdit() method to cancel the edit operation.
Delete Row:
- Handle the RowDeleting event.
- Get a data source.
- Use the e.Keys property to get the edited data item from the data source.
- Delete this data item.
- Save the changes to the data source.
- Set the event’s e.Cancel property to
trueto cancel the edit operation.
See Also