First off, that test will never work:
theRow.Cells[colIndex].Value.Equals(null)
Translates to:
Object o;
o.Equals(null)
If the object being tested is null, then there is by definition no instance to call the Equals method on, and since it cannot be static, a null value will always throw an execption, before it can try to test for a null value!
You could try with:
theRow.Cells[colIndex].Value == null
Which stands a better chance of working!