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

Capture Row Delete Event

5 Answers 678 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Dennis Sebenick
Top achievements
Rank 1
Dennis Sebenick asked on 09 Jul 2010, 12:20 AM
The radgridview that I've setup allows a user to click the delete button to delete a row.  This works well, but I'd like to prompt the user to confirm a delete.  I've tried to see if there is an event to capture the delete and allow a cancel, but it does not appear to exist.  I realize I could use a delete button, but I do not wish to use this.

Thank you in advance,
   Dennis

5 Answers, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 14 Jul 2010, 02:52 PM
Hello Dennis Sebenick,

Thank you for your question.

You can use the RowsChanging event to cancel deleting of a row in RadGridView:

private void radGridView1_RowsChanging(object sender, GridViewCollectionChangingEventArgs e)
{
    if (e.Action == NotifyCollectionChangedAction.Remove)
    {
        e.Cancel = true;
    }
}

I hope it helps. Please write back if you have further questions.

Best regards,
Alexander
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
0
Alex
Top achievements
Rank 1
answered on 15 Feb 2018, 03:50 PM

The system doesn't like 'NotifyCollectionChangedAction' so I added:

using System.Collections.Specialized;

Now it tells me the operand are incompatible:

        private void grdvwPtOfContact_RowsChanging(object sender, GridViewCollectionChangingEventArgs e)
        {
            if (e.Action == NotifyCollectionChangedAction.Remove)
            {
                e.Cancel = true;
            }
        }

How do I fix this?

 


0
Dimitar
Telerik team
answered on 16 Feb 2018, 11:21 AM
Hello Alex,

The following snippet shows the full types that you need to use:
private void RadGridView1_RowsChanging(object sender, Telerik.WinControls.UI.GridViewCollectionChangingEventArgs e)
{
    if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Remove)
    {
 
    }
}

I hope this will be useful. Let me know if you have additional questions.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Alex
Top achievements
Rank 1
answered on 16 Feb 2018, 12:38 PM

        private void grdvwResponsParty_RowsChanging(object sender, GridViewCollectionChangingEventArgs e)
        {
            if (Convert.ToInt16(e.Action) == Convert.ToInt16(NotifyCollectionChangedAction.Remove))
            {
                    e.Cancel = true;
            }
        }

What worked for me was the above

 

 

0
Dimitar
Telerik team
answered on 19 Feb 2018, 10:39 AM
Hello Dennis,

I am glad that you have found a solution for your case. Do not hesitate to contact us if you have other questions.
 
Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
GridView
Asked by
Dennis Sebenick
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Alex
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or