This is a migrated thread and some comments may be shown as answers.
How to capture a client-side delete row event for a RadGrid with BatchEdit?
2 Answers 44 Views
This is a migrated thread and some comments may be shown as answers.
dave
Top achievements
Rank 1
dave asked on 24 Feb 2014, 05:41 PM
I'm currently using a RadGrid with EditMode=Batch.  I need a client-side notification of changes to the grid to do some screen updates.  For Update and Insert changes I'm listening to the OnBatchEditCellValueChanged event, and that's working fine.

How can I get a client-side notification of a row being deleted by the user?  The grid currently has a Delete Button column (GridButtonColumn with a CommandName of Delete) which the user is clicking, but I'm open to other solutions.  When the user clicks the button, the row is actually deleted from the screen and the delete is sent to the server as part of a Save Changes.  The only part that's missing is a client-side notification.

I've tried the obvious choices of OnRowDeleting, OnRowDeleted, OnRowDestroying, and OnRowDropped, but none of those seem to work with BatchEdit.  I think that I need something like OnBatchEditRowDeleted, but that doesn't exist.

Any ideas on how to make BatchEdit and RowDelete play nice with each other and generate a client-side event?

Thanks,
DaveL

2 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 27 Feb 2014, 02:08 PM
Hi Dave,

Thank you for contacting us.

Our developers are planning to include this kind of event for the future releases, but I'm not able to give any additional details whether it will be a new event or one of the existing grid delete handlers.

You can use the following approach for the time being:
Telerik.Web.UI.GridBatchEditing.prototype.original_deleteRecord =
       Telerik.Web.UI.GridBatchEditing.prototype.deleteRecord;
Telerik.Web.UI.GridBatchEditing.prototype.deleteRecord = function (t, r) {
    myHandlerName(this.get_owner());
    this.original_deleteRecord(t, r);
}
function myHandlerName(grid) {
    alert("Record will be deleted from grid: " + grid.get_id());
}

Hope this helps. Please give it a try and let me know if it works for you.

Regards,
Eyup
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
0
Mira
Top achievements
Rank 1
answered on 26 Sep 2017, 06:56 PM

I am wondering if you included any updates on the previous version. 

I am using RadGrid with EditMode - batch (RadGrid1_BatchEditCommand). I am using 5 grids at the same time. I would need to fire some events on delete and add new item buttons but whatever I use, it is not fired. It is required that I do validation on client side on the number of rows (if it is 1 that I cannot delete and if it is > 10 that it doesn't add new record).

If you have any solution for me to do it I would really appreciate.

Thanks. Mira

 

Tags
Grid
Asked by
dave
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Mira
Top achievements
Rank 1
Share this question
or