ASP.NET GridView Delete
The GridView control provides many built-in capabilities that allow the user to sort, update, delete, select, and page through items in the control. The following tutorial shows how to delete a row from Gridview and display a confirmation message before deleting the specified row.
In this article I have used Microsoft's Pubs database for sample data. You can download it free from the following link.
Before you start to create Edit functionality on GridView in your asp file, you should create a ConnectionString in your web.Config File. Double click the web.config file on the right hand side of the Visual Studio and add the following connectionstring code in that file.
To enable delete , set the AutoGenerateDeleteButton to true and specify the delete command in the SqlDataSource.
The follwoing ASP.NET program shows how to delete a row from Gridview and display a confirmation message before deleting the specified row.
Click the following links to see full source code
- ASP.NET Simple GridView
- Sorting , Paging and AutoGenerateColumns
- ASP.NET GridView Editing
- DropDownList in GridView
- Create Gridview at runtime
- Gridview - Add, Edit and delete
- Gridview export to Excel
- Gridview export to CSV
- GridView summary on Footer
- Subtotal row in Gridview
- SubTotal and GrandTotal in GridView
- Create Gridview without database
- GridView from Stored Procedure
- How to create Gridview Popup Form
- How to create a Blank row in gridview
- Nested GridView in ASP.NET
- Freeze Gridview Header row, Scroll in GridView
- Auto Generate Row Number in GridView
- Image between GridView rows
- How to select a row in gridview
- Checkbox in ASP.NET GridView Control