// remove first row grid.get_rows().remove(grid.get_rows().get_row(0));
To delete data in WebDataGrid™, add the RowDeleting behavior to the Behaviors collection. This behavior allows your end-users to delete rows in WebDataGrid. You also need the Selection behavior enabled for deleting to function in the UI. When enabling RowDeleting in the designer you will be prompted to add the Selection behavior as well.
A row can be deleted by selecting the row and pressing the delete key.
You will allow row deletion in the WebDataGrid control.
Bind WebDataGrid to a SqlDataSource component retrieving data from the Customers table. For more information on doing this, see Getting Started with WebDataGrid.
In the Microsoft® Visual Studio™ property window, Set the DataKeyFields property to CustomerID so that changes in WebDataGrid can be updated to the data source.
In the same window, locate the Behaviors property and click the ellipsis (…) button to launch the Behaviors Editor Dialog.
Check the CheckBox next to Row Deleting from the list on the left to add and enable the behavior. You are prompted to add Selection as well.
Click Yes to confirm the prompt. The Selection and RowSelectors behaviors are added to WebDataGrid.
Click Apply then Ok.
Check that EnableAjax is True in the property window of WebDataGrid. If not, set it to True. Now when you select a row in WebDataGrid and press DELETE, the row is deleted from the control as well as the underlying data source.
You can also delete a row programmatically on the client
In JavaScript:
// remove first row grid.get_rows().remove(grid.get_rows().get_row(0));