7 Answers, 1 is accepted
One possible realization is to subscribe to the OnBatchEditCellValueChanging client event and check the value in the other cell. If it is equal to the newly entered one you can alert the user and cancel the event. When following this approach the user will be prevented from entering a duplicate value.
Since the EditMode is set to Batch I would recommend using only a client-side solution. If the controls in the edit item cause a postback the changes made by the user will be lost.
Now to the solution of the problem. As I started in my previous post the correct approach would be to cancel the BatchEditCellValueChanging according to the value in the other cell. According to the version used in the real application the related cell value can be obtained in two ways:
- With the Q2 2013 service-pack version - using the BatchEditGetCellValue and obtaining a reference to the other cell.
- With the latest internal build you can directly obtain a reference to the related cell in the event handler as there are additional arguments exposed.
Please find in attachments the two fully runnable website which demonstrate the mentioned approaches. Note that we are always improving the Batch edit mode and the internal build provides a richer functionality than the service-pack(keyboard navigation, additional events are exposed and so on). The mentioned features will be included in the upcoming Beta release.
One possible solution is to subscribe to the OnUpdateCommand event of the grid and cancel it if the text in the editors is the same:
Another solution would be to subscribe to the OnCommand client event of the grid and cancel the update: