Intersoft WebGrid Documentation
Walkthrough: Deleting a record using WebGrid button
See Also Send comments on this topic.

Glossary Item Box

Use JavaScript to programmatically delete a row on client side. The Delete method will be called in a button-click event.

During this walkthrough, you will learn how to do the following:

 Prerequisites

In order to complete this walkthrough, you will need the following:

  • Visual Studio 2005 Application.

 Step-By-Step Instructions

To delete a record using WebGrid button

  1. Binding WebGrid to AccessDataSource.
  2. Add a column and set its ColumnType as Button.
  3. Make sure the column's ButtonAutoPostback property is set to false.
  4. Apply this script to the page:

    JavaScript Copy Code
    <script language="javascript">
     
        function WebGrid1_OnButtonClick(gridId, tblName, colName, cellValue) {  
            var grid = ISGetObject(gridId);
            var row = grid.GetSelectedObject().GetRowObject();
            row.Delete();
            return true;
        }
     
    </script>
    

  5. Register the function to the grid's OnButtonClick client-side event.
  6. Run the project.

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.