delete all empty rows in datatable c# code example
Example 1: datatables clear table
const table = $("#yourTable").DataTable();
table.clear().draw(); // make sure to call draw() to see the table empty
Example 2: c# remove rows from datatable
for(int i = dtPerson.Rows.Count-1; i >= 0; i--)
{
DataRow dr = dtPerson.Rows[i];
if (dr["name"] == "Joe")
dr.Delete();
}
dtPerson.AcceptChanges();