I am not sure why you have put up this condition but this is stopping you from making any column before last as just a text:
if (j < dt.Columns.Count - 1)
{
tc.InnerText = dt.Rows[i][j].ToString();
}
If you notice, your link buttons are created only when '
j
' is having column count value (that would be last column.)
If you want links in all columns, just remove the
if
and let all the code in else to get executed.