Here I will explain how to delete particular row from datatable or delete selected rows from datatable in asp.net using C# and VB.NET.
In previous articles I explained Check username availability with progressbar, Richtextbox example in asp.net, Asp.net Interview questions, Joins in SQL Server, Highlight Gridview records based on search and many articles relating to Gridview, SQL ,jQuery,asp.net, C#,VB.NET. Now I will explain how to delete particular row from datatable or delete selected rows from datatable in asp.net using C# and VB.NET.
We can delete datatable rows by using delete method for that check below code
DataTable dt1 = new DataTable();
dt1 = ds.Tables;
for (int i = 0; i < dt.Columns.Count;i++ )
if (i == 3)
dt.Rows[i - 1].Delete();
Dim dt1 As New DataTable()
dt1 = ds.Tables(0)
For i As Integer = 0 To dt.Columns.Count - 1
If i = 3 Then
dt.Rows(i - 1).Delete()