This is probably going to depend on your data, which we don't have access to.
Start start by using the debugger, and set a breakpoint on the line:
index = (int)GridView1.DataKeys[row.RowIndex].Value;
When it hits the breakpoint, execution should stop, and let you look at what is going on.
At at the row, and it's RowIndex property, then check that against the DataKeys collection.
At a guess, it's empty, so you get the error.
A quick look at the documentation
GridView.DataKeys Property (System.Web.UI.WebControls)[
^] says it might be the setting of the DataKeyNames property - but you need to look at the data while it's running to confirm exactly what you have.