Before the assignment, you can validate whether the particular cell has the value or not.
if (dgMessages.Rows[RowAdj].Cells["clmTransMessage"].HasValue)
{
String MesId=dgMessages.Rows[RowAdj].Cells["clmTransMessage"].Value.ToString();
}
Itz safer code to avoid index out of range error.