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

Delete row on grid

6 Answers 921 Views
GridView
This is a migrated thread and some comments may be shown as answers.
thanhh83
Top achievements
Rank 1
thanhh83 asked on 22 May 2007, 07:36 AM
I want delete a row on GridView. But i don't know how to delete it and update it to database

Help me please

Thanks and regards

6 Answers, 1 is accepted

Sort by
0
PortVista
Top achievements
Rank 2
answered on 22 May 2007, 12:15 PM
There are 4 or 5 ways to do this. We'll give you a better answer if you tell us more info...
0
thanhh83
Top achievements
Rank 1
answered on 22 May 2007, 02:35 PM
I'm using dataTable load data from database, binding this datatable to datasource of gridview. And i'm using "Right Click" to select "delete row". And this row has been deleted on GridView. Now i want after "delete row" it will delete this row on GridView and it will delete this item on database.

I don't known Event ocurr when delete this row. Please give me that event

Thanks and regards
0
Sasa Milovic
Top achievements
Rank 1
answered on 10 Jul 2007, 11:21 AM
I have a similar query

When deleting a row of the grid, I would like to capture the event, query the row, and then inform another object that this row has been deleted.

The problem is I cannot find a method such as userDeletingRow as available in the MS grid.
0
Julian Benkov
Telerik team
answered on 10 Jul 2007, 03:43 PM
Hi Sasa,

We have just replied to your support ticket on the matter.

Currently we are not providing an event for the delete operation. This feature will be included in our Q2 release. What you can do is use the IBindingList ListChanged event if your bound objects support the IBindingList interface.
 

Regards,
Julian Benkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
hipero
Top achievements
Rank 1
answered on 13 Oct 2009, 11:36 AM
But you can do something like this:


        private void dataGridViewMain_RowsChanging(object sender, GridViewCollectionChangingEventArgs e)
        {
            if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Remove) 
            { 
                DialogResult dialogResult = MessageBox.Show("Do you want to delete this product?", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); 
                if (dialogResult != DialogResult.OK) 
                {
                    e.Cancel = true; 
                } 
            }
        }

and add your code to update data in data base :).
0
Julian Benkov
Telerik team
answered on 02 Sep 2010, 02:09 PM
Hi ,

In Q2 2010 release we introduced UserDeletingRow and UserDeletedRow events. You can use them in your scenario.

All the best,
Julian Benkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
thanhh83
Top achievements
Rank 1
Answers by
PortVista
Top achievements
Rank 2
thanhh83
Top achievements
Rank 1
Sasa Milovic
Top achievements
Rank 1
Julian Benkov
Telerik team
hipero
Top achievements
Rank 1
Share this question
or