Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
240
Delete row in grid
posted

Hi Guys,

I have a simple webGrid in which I have placed a 'delete' button in the first column, I need to find some way to delete the row from the grid (via on click event possibly????/), unfortunatley due to my clients strict no javascript policy I'm finding this incredibly difficult.

Help !
Cheers
Marc

ps. I have tried numerous demo's on this site without success

Parents
  • 45049
    Suggested Answer
    posted

    Marc,

    This would be best done through JavaScript - which, in your circumstance, may be an issue.

    I would use a column whose Type is "Button" for the delete button, because this makes it easiest to get a reference to grid objects through the event raised.  I'd then handle the grid's client-side ClickCellButton event, with code similar to the following (note that I'm going by documentation, since I can't test this at the moment):

    function ultraWebGrid1_ClickCellButtonHandler(gridName,cellId)
    {
        // Get a reference to the cell that contains the button that was clicked
        var cell = igtbl_getCellById(cellId);

        // Ensure that the cell is in the "Delete" column - replace the condition based on the Key of the column
        if (cell.Column.Key == "Delete")
        {
            // Get a reference to the row that contains the cell
            var row = cell.getRow();

            // Delete the row
            row.deleteRow();
        }
    }

Reply Children
No Data