protected void gv_UpdateMedicalStatus_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { DropDownList ddlmedical = gv_UpdateMedicalStatus.Rows[e.RowIndex].FindControl("ddlMedicalStatus") as DropDownList; ICandidateManager objcandidateManager = CandidateManagerFactory.Candidate_Manager(); Label lb1 = (Label)gv_UpdateMedicalStatus.Rows[e.RowIndex].FindControl("lbCandidateID"); Label lb2 = (Label)gv_UpdateMedicalStatus.Rows[e.RowIndex].FindControl("lbTestStatus"); if (ddlmedical.SelectedValue != "rejected" && lb2.Text == "medical testing") { lb2.Text = "BGC initiated"; } int inta = Convert.ToInt32(ddlmedical.SelectedIndex); inta++; int intb = 0; if (lb2.Text == "written conducted") { intb = 1; } else if (lb2.Text == "technical conducted") { intb = 2; } else if (lb2.Text == "HR conducted") { intb = 3; } else if (lb2.Text == "medical testing") { intb = 4; } else if (lb2.Text == "BGC initiated") { intb = 5; } else if (lb2.Text == "confirmed") { intb = 6; } int inti = objcandidateManager.med_update(Convert.ToInt32(lb1.Text), intb, inta); if (inti == 0) { string script2 = "alert('The test status is " + lb2.Text + " for candidate with id: " + lb1.Text + ".');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script2, true); } else { string script2 = "alert('Successfully updated Medical Test Status.');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script2, true); } gv_UpdateMedicalStatus.EditIndex = -1; med_Status(Convert.ToInt32(ddlVacancyID.SelectedValue)); } catch (Exception) { } }