Delete DataRow from DataTable Asp.Net

How to Delete DataRow from DataTable based on specific condition in Asp.net

October 14, 2020
DataTable dtBlogs = new DataTable();
 
int i = 0;
foreach (DataRow row in dtBlogs.Rows)
{
    if (i > 4) // IF Condition as per your requirement
        row.Delete();
    i++;
}
dtBlogs.AcceptChanges();

Post Comments(0)

Leave a reply

Will not be displayed in comment box .

Loading...