protected void Eliminar(object sender, EventArgs e) { //revisar Requ_Numero = Request.QueryString["Requ_Numero"].ToString(); Reqd_CodLinea = Request.QueryString["Reqd_CodLinea"].ToString(); Reqs_Correlativo = Request.QueryString["Reqs_Correlativo"].ToString(); String path = Server.MapPath(FolderAlquiler); ImageButton btnEliminar = ((ImageButton)sender); GridViewRow grdrow = (GridViewRow)((ImageButton)sender).NamingContainer; string IDE_FILE = GridView1.DataKeys[grdrow.RowIndex].Values["ide_LegajoFile"].ToString(); string Archivo = GridView1.DataKeys[grdrow.RowIndex].Values["FILE_ARCHIVO"].ToString(); BL_TBL_RequerimientoSubDetalle obj = new BL_TBL_RequerimientoSubDetalle(); DataTable dtResultado = new DataTable(); try { if (File.Exists(path + Archivo)) { File.Delete(path + Archivo); } } catch (Exception ex) { } dtResultado = obj.uspDEL_TBL_REQUERIMIENTOSUBDETALLE_LEGAJOFILE(Convert.ToInt32(IDE_FILE)); if (0 == Convert.ToInt32(dtResultado.Rows[0]["ID"].ToString())) { string cleanMessage = "No se puede eliminar archivo, grupo de documentos asociados a más requerimientos"; ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true); } else { file(); } }