My guess is that you're setting the border style AFTER you've set the border itself.
foreach (TableCell cell in row.Cells)
{
cell.BorderStyle = grdMaterials.BorderStyle;
if (row.RowIndex % 2 == 0)
{
cell.BackColor = grdMaterials.AlternatingRowStyle.BackColor;
cell.BorderColor = Color.Black;
}
else
{
cell.BackColor = grdMaterials.RowStyle.BackColor;
}
cell.CssClass = "textmode";
}