I have Price, Qty and Amount columns in a databound grid with DataTable as data source.
When ever price or Qty changes, I want to recalculate amount and show the new value in the same row. For this I have CellDeactivated event handler. Something is going wrong and it is adding blank rows all the time.
1. Please run the attached sample.
2. Click on Price cell and enter 55. Why am I getting an exception here?
3. Put in 5 for qty. It calculates amount properly.
4. Now click on the last row again. Enter 4 for Price and click on 5 first row, Qty column. Why is it adding a new row here?
5. When ever you click on LastRow-1 and click back on the row above it, it is adding a new row.
I tried this on 1.6.06 and 1.5.2 as well. Samething happened.
Can you look at the attached sample and let me know what is going on.
ADAdministrator Syncfusion Team June 18, 2003 10:29 AM
CurrentCellDeactivated is not a good place to do this kind of thing. First it is called too often, and the is without an active cell at this point. The first exception, you are seeing is due to an initial DeactivateCell as the clicked cell is getting focus. After that, there are other exceptions being thrown by trying to parse as a double a value of DBNull. I think all these tings are contributing the weird new row behavior because the exceptions are being thrown as you click into a empty row.
Anyway, I think you can tweak your code an dmove it to CurrentCellConfirmChanges, and get things to work without these problems. Here is the handler I tried.