Thursday, August 14, 2008

How To Remove Empty Rows In DataTable

int i = 0;
while (i <= datatableid.Rows.Count - 1)
{
if (datatableid.Rows[i]["ColumnName"].ToString().Trim() == string.Empty)
{
datatableid.Rows.RemoveAt(i);
}
else
{
i += 1;
}
}

2 comments:

Shona said...

This Code is Dammmmmmmmn Good

Dhaval said...

Thanks a lot buddy!! Saved my day!