I will extend my previous example in which I have explained you that how to create a DataTable in asp.net.
You can delete rows from a data table by using Delete Method. After deleting row, you have to call AcceptChanges Method to commit all changes in datatable. In this example. I have deleted 2nd row as i have passed 1st index of the row because index count start from the zero.AcceptedChanges method has been applied to commit changes in datatable.
Here’s an example
DataTable dt = new DataTable();
DataRow dr = null;
dt.Columns.Add(new DataColumn("FullName", typeof(string)));
dt.Columns.Add(new DataColumn("Age", typeof(Int16)));
for (int i = 0; i < 10; i++)
{
dr = dt.NewRow();
dr["FullName"] = String.Format("Aamir Hasan_{0}", i.ToString());
dr["Age"] = 20;
dt.Rows.Add(dr);
}
dt.Rows[0]["FullName"] = "Faisal Hameed";
dt.Rows[0]["Age"] = 20;
dt.AcceptChanges();
Output
