i think u forgot to set id as
datakeyname
otherwise try this code
Instead of
int res = Convert.ToInt32(GridView1.DataKeys[gv.RowIndex].Value);
try
int res = Convert.ToInt32(GridView1.gv.Cells[1].Text);
//where cells[1] means column position of that id field