I have declared a datatable withevents. I have bound this table to a datagrid. I have deleted two rows from the datatable using the delete key. Now I have added two blank rows instead and then I am again trying to bind the datagrid back. If already the datatable has 'n' rows to display, after deleting also it should show 'n' rows to the user. But internally the datatable will contain 'n + number of deleted rows'.
I have used the datable_deleting and datatable_deleted events for the above. But even though the data found in the datatable are correct. The binding still shows 'n - number of deleted rows'.
For example :
Private withevents dttemp as datatable
datagrid : dgTemp
dgtemp.datasource = dttemp
After deleting 2 rows in the datagrid, the cursor goes to dttemp_deleting event where
- I am adding a new row for one of the deleted rows
- generating new serial numbers
The cursor then goes to dttemp_deleted event where
- I am using dgtemp.refresh
- I am binding the datatable to the dtgrid i.e dgtemp.datasource = dttemp
But the blank rows are not displayed in the front end.
What should I do for this problem? Is there any other way I can handle?
Please help me on this problem.
Thanks and regards