Delete row/rows from any level in WebHierarchicalDataGrid

Hello All,

I hope the function below will be useful in scenarios that require deletion of rows from WHDG. The function  shows how to delete row from any level of WebHierarchicalDataGrid. We have used it in varies samples :

<script type="text/javascript">
        function DeleteRow() {
            var grid = $find('<%= Me.WebHierarchicalDataGrid1.ClientID %>');
            var selection = grid.get_gridView().get_behaviors().get_selection();
            /* these will be the selected rows accross all grids, this is an array, but since u have
            single selection it should be an array of one row */

            var selectedRows = selection.get_selectedRowsResolved();
            for (var i = 0; i < selectedRows.length; i++) {
                var row = selectedRows[i];
                var containerGrid = row.get_grid();
                var gridRows = containerGrid.get_rows();
                gridRows.remove(row);
            }
        }
    </script>


Comments  (1 )

Jayanthan Jegatheesw
on Mon, Jul 22 2013 1:32 AM

i have palced the grid in a seperate aspx file where it doesn't contain content page.

kindly provide me a sample of code. i m stuck with this for about 4 days.

Add a Comment

Please Login or Register to add a comment.