How to capture a client-side delete row event for a RadGrid with BatchEdit?

3 posts, 0 answers
  1. dave
    dave avatar
    10 posts
    Member since:
    Mar 2011

    Posted 24 Feb 2014 Link to this post

    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. Eyup
    Admin
    Eyup avatar
    3726 posts

    Posted 27 Feb 2014 Link to this post

    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.
  3. Mira
    Mira avatar
    1 posts
    Member since:
    Mar 2017

    Posted 26 Sep 2017 in reply to dave Link to this post

    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

     

Back to Top