How to Delete DataGrid Rows Using ASP.NET
A "DataGrid" is an ASP.NET component you place on your Web pages to display several rows of data. The DataGrid removes the need to manually create tables in your Web pages. Instead, the DataGrid provides programmers with an automated element that builds the table. The programmer just needs to fill the DataGrid with data. After you fill the DataGrid, you can delete certain rows using the "Delete" function.
Instructions
-
-
1
Click the Windows "Start" button and select "All Programs." Click "Microsoft .NET Framework," then "Visual Studio" to load the .NET programming interface.
-
2
Click the "Open" toolbar icon. In the opened dialog window, double-click the project file you want to edit. In the "Solution Explorer" panel, right-click the form that contains the DataGrid and select "View Code."
-
-
3
Type the following code to delete a DataGrid row:
grid.Rows[2].Delete();
The code above deletes the second row in the DataGrid. Change the "2" to the row number you want to delete.
-
4
Click the "Save" toolbar item. Click "Run" to view the DataGrid changes in your Web browser.
-
1