so many ways but as per requirement ...
1) in databound event : DataGridViewCell cell = this.dataGridView[e.ColumnIndex, e.RowIndex];
you can use this in for loop
2) string strFirstName = Grid1.Rows[3].Cells["FirstName"]
3) GridViewRow gRow = GridView1.Rows[RowIndex];
e.g.
for (int i = 0; i < grdMyGrid.Rows[0].Cells.Count; i++)
{
grdMyGrid.Rows[0].Cells[i].Width = Unit.Pixel(200);
}
in javascript
var n = document.getElementById("GridView1").rows.length;
var i;
for (i = 2; i <= n; i++) {
tb = document.getElementById("GridView1_ctl0" + i + "_TextBox1");
tb.value = i;
}