This is a migrated thread and some comments may be shown as answers.

Deleting a row from a dynamically populated gridview

3 Answers 86 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Derek
Top achievements
Rank 1
Derek asked on 17 Jun 2009, 12:03 PM
Hi,
My radgridview is dynamically populated and I am trying to delete a row. It deletes it from the grid but not from the database. My code is as follows:

'bsMaintenance is the bindingsource

bsMaintenance.RemoveCurrent()

bsMaintenance.EndEdit()


'Save changes

Dim

 

myBuilder As SqlCommandBuilder = New SqlCommandBuilder(daDataAdapter)

 

 

Dim iResult As Integer

 

 

Dim bResult As Boolean = False

 

bsMaintenance.EndEdit()

myBuilder.GetUpdateCommand()

 

daDataAdapter.UpdateCommand = myBuilder.GetUpdateCommand()

 

daDataAdapter.Update(DSData, "TBL_CALL_TYPES")

 




Any help would be appreciated.


3 Answers, 1 is accepted

Sort by
0
Martin Vasilev
Telerik team
answered on 22 Jun 2009, 06:58 AM
Hi Derek,

Thank you for writing. I cannot see anything wrong in your code. It is not related to RadGridView functionality and it should work. You can try to use the Update method without changing the UpdateCommand. Also check if you have a primary key in your table which has to be updated. This is necessary for the Update method to work properly.

All the best,
Martin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Derek
Top achievements
Rank 1
answered on 23 Jun 2009, 09:40 AM
It's working now, it seems it lost its currentrowchanging event handler.  Sometime this happens when I copy and paste a control.
0
Martin Vasilev
Telerik team
answered on 25 Jun 2009, 03:27 PM
Hello Derek,

I am glad that you have managed to find a solution. Do not hesitate to contact me again if you need additional assistance.

Best wishes,
Martin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Derek
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Derek
Top achievements
Rank 1
Share this question
or