Hi,
I have a website on NET 2.0, there I have a textbox and after I change the text on it with a js function, try to save on the DB (I have to click on a imagebutton to save it), but on the postback the textbox.text property has the previous value.
I need some guidance on how to resolve this.
Here's my code:
JS inserted with a RegisterClientScriptBlock method: <-- This works fine
<script type="text/JavaScript">
function Calcular() {
if (!(isNaN(parseFloat(document.getElementById('ctl00_cphVentanillaAtencionMaster_txtdcPagSaldoPrevioPago').value)) && isNaN(parseFloat(document.getElementById('ctl00_cphVentanillaAtencionMaster_txtdcPagPagoActual').value)))) {
document.getElementById('ctl00_cphVentanillaAtencionMaster_txtdcSaldoPostPago').value = parseFloat(document.getElementById('ctl00_cphVentanillaAtencionMaster_txtdcPagSaldoPrevioPago').value) - parseFloat(document.getElementById('ctl00_cphVentanillaAtencionMaster_txtdcPagPagoActual').value);
} else {
document.getElementById('ctl00_cphVentanillaAtencionMaster_txtdcSaldoPostPago').value = '0.0';}
}
function ActualizaMonto() {
if (!(isNaN(parseFloat(document.getElementById('ctl00_cphVentanillaAtencionMaster_txtdcPagSaldoPrevioPago').value)) && isNaN(parseFloat(document.getElementById('ctl00_cphVentanillaAtencionMaster_txtdcPagPagoActual').value)))) {
document.getElementById('ctl00_cphVentanillaAtencionMaster_txtdcPagSaldoPrevioPago').value = parseFloat(document.getElementById('ctl00_cphVentanillaAtencionMaster_txtdcPagMontoTotal').value);
} else {
document.getElementById('ctl00_cphVentanillaAtencionMaster_txtdcPagMontoTotal').value = '0.0';}
}
</script>
on PostBack I try to do this:
oPagosBE.btPagActivo = True
oPagosBE.dcPagMontoTotal = Me.txtdcPagMontoTotal.Text
oPagosBE.dcPagPagoActual = Me.txtdcPagPagoActual.Text
oPagosBE.dcPagSaldoPrevioPago = Me.txtdcPagSaldoPrevioPago.Text <--- THIS VALUE POSTBACKS WITH THE INITIAL VALUE (BEFORE JS)
oPagosBE.dtPagFechaRegistro = IIf(IsDate(Me.txtdtPagFechaRegistro.Text.Trim), Me.txtdtPagFechaRegistro.Text.Trim, #1/1/1900#)
oPagosBE.vcPagUsuarioRegistrante = Session.Item("vcUsuCodigo")
bExito = bPagosBL.Insertar(oPagosBE)
Thanks