I am using a Gridview that is a hodgepodge of databound controls including textboxes, labels and dropdown lists. Each row in the gridview is conglomerate of a record from a primary table and its subordinate details.
All data operations (select, insert, update and delete) are handled by a data tier consisting of middleware and COBOL... database is DB2. A preformatted request is sent out and a datatable is returned.
The datatable is then bound to the datagrid assigning it to the datasource.
With that preface in mind, the program presents the user with the friendly gridview and they click on the select button on the item in the gridview they wish to delete. They click the (separate from gridview) delete button. The button event issues another request through the aforementioned data tier. There is nothing returned as it was decided that would be to much overhead.
I just want to refresh the gridview (no problem initiating a refresh) and have the deleted item to no longer display. I tried using the following logic to remove the item from the module level datatable (retruned from the initial select), and then delete row from the gridview:
With Gridview1
psReplyData.Rows(.Selected
Index).Del
ete()
.DeleteRow(.SelectedIndex)
End With
This is performed in the in the delete button_click event. By the time it reaches this code the psReplyData datatable object is set back to nothing. It is still bound to the Gridview1, but is only mnemonic and no longer part of an object I can access. I believe that the statelessness of the objects is the major problem. When the gridview refreshes itself and runs its Load event, everything is set to nothing and the Gridview still has its original set of data in memory only.
Just performing the DeleteRow on the Gridview doesn't accomplish this task because of what was discussed in the last paragraph.
I may be stuck with adding the piggy overhead of making it recreate the datatable with the latest data.
Any input would be greatly appreciated. Also, I am a VB programmer. I can read C# but if code is shared, vb would be preferred. Thanks in advance.
Start Free Trial