Did you set breakpoints and see what code is executed exactly and values assigned to the variables. e.g.:
if (row.Cells[0].Text == "Topic")
There you are accessing first Column, so what is the text value? Is that your first column?
Can you share your DV markup?