protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "edit") { CAssessFactory assessFactory = new CAssessFactory(); CPatientFactory patientFactory = new CPatientFactory(); int index = Convert.ToInt32(e.CommandArgument); GridView GridViewTest = (GridView)e.CommandSource; GridViewRow row = GridViewTest.Rows[index]; string name = row.Cells[2].Text; int assess_id = assessFactory.getId(name); string patient_id = patientFactory.getById(row.Cells[1].Text).id; int schedule_id = Convert.ToInt32(row.Cells[6].Text); Response.Write("<script>Submit();</script>"); Response.Redirect("assess.aspx?pid=" + patient_id + "&aid=" + assess_id + "&sid=" + schedule_id); } }