protected void Page_Load(object sender, EventArgs e) { if (!Page.IsCallback) { try { if (Session["IDRED"] == null) { try { Response.Redirect("~/SesionCaducadaModal.aspx", true); } catch (System.Threading.ThreadAbortException) { return; } } // Leer Empresa if (Request.QueryString["bNueva"] != "true") { hdnID.Text = Request.QueryString["ID"].ToString(); EMPRESA oEMPRESA = EMPRESA.Select(null, int.Parse(hdnID.Text)); txtCodigoExterno.Text = oEMPRESA.t302_codigoexterno; txtDenominacion.Text = oEMPRESA.t313_denominacion; if ((bool)oEMPRESA.t313_estado) { chkActiva.Checked = true; } else { chkActiva.Checked = false; } if ((bool)oEMPRESA.t313_ute) { chkUTE.Checked = true; } else { chkUTE.Checked = false; } txtHorasAnu.Text = float.Parse(oEMPRESA.t313_horasanuales.ToString()).ToString("##,###,###"); txtInteresesGF.Text = float.Parse(oEMPRESA.t313_interesGF.ToString()).ToString("###,###.##"); txtCCIF.Text = oEMPRESA.t313_CCIF; txtCCIE.Text = oEMPRESA.t313_CCICE; hdnIDDieta.Text = oEMPRESA.T069_iddietakm.ToString(); txtDesDieta.Text = oEMPRESA.t069_descripcion; } } catch (Exception ex) { sErrores += Errores.mostrarError("Error al obtener los datos de la empresa", ex); } //1º Se indican (por este orden) la función a la que se va a devolver el resultado // y la función que va a acceder al servidor string cbRespuesta = Page.ClientScript.GetCallbackEventReference(this, "arg", "RespuestaCallBack", "context", false); string cbLlamada = "function RealizarCallBack(arg, context)" + "{" + cbRespuesta + ";" + "}"; //2º Se "registra" la función que va a acceder al servidor. Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "RealizarCallBack", cbLlamada, true); } }