int autoid = Convert.ToInt32(((Label)GridView1.Rows[e.RowIndex].FindControl("Label12")).Text);// error is in this line
The text of your Label Label12 isn't an interger value.
FormatException[
^] is thrown when the format of an argument does not meet the parameter specifications of the invoked method.
You could use
Int32.TryParse Method[
^] instead. This will try to parse your string and if it's a correct integer, it will return true and the value will be returned in an out variable which then can be used as a parameter.
Put a debugger on that line, check the label text and things will be very clear to you.
Hope this helps!