Binding Datagrid with Datatable - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Binding Datagrid with Datatable

niveditadniveditad Posts: 1Member
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


Sign In or Register to comment.