protected void gvResults_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Edit") { // Retrieve the row index stored in the // CommandArgument property. int index = Convert.ToInt32(e.CommandArgument); int i = (int)GridView1.DataKeys[index].Value; Session["UserEdit"] = dataUser.getUserEdit(i); Response.Redirect("/updateUser.aspx"); } }