How to Delete a Single Row From the Gridview in ASP.NET Using VB
The "DeleteRow" function lets you delete one row in a VB.NET GridView control. The GridView control displays a list of records, and it lets you delete and add rows to the user's view. You can delete a row with a program or with user input. You must specify the row index to delete, and the row is removed from the user's view immediately.
Instructions
-
-
1
Click the Windows "Start" button and select "All Programs." Click "Microsoft .NET," then click "Visual Studio" to open the software. Open your Web project.
-
2
Right-click the form file in Solution Explorer and select "View Code." The VB.NET source code opens in the editor. Scroll down to the function you want to use to delete the GridView's row.
-
-
3
Type "grid1.DeleteRow(grid1.SelectedIndex)" (without quotes) to delete a row. VB.NET deletes the row the user selects. Insert any integer in the DeleteRow parameters to delete the specified row. The grid's index numbers for rows begin at zero, so if you want to delete the first row, use "0" in the function's parameters.
-
1