This is my role:
<script type="text/javascript">
function montaDataSubstituicaoPrestador(dt_exclusao) {
var arrData = dt_exclusao.split('/');
var exclusaoFormatada = arrData[1] + '-' + arrData[0] + '-' + arrData[2];
var dias = parseInt(prazoSubPrestador);
var novaData = new Date(arrData[2], arrData[1] - 1, arrData[0]);
novaData.setDate(novaData.getDate() + dias);
hoje = new Date(novaData)
dia = hoje.getDate()
mes = hoje.getMonth()
ano = hoje.getFullYear()
if (dia < 10)
dia = "0" + dia
if ((mes + 1) < 10)
mes = "0" + (mes + 1);
if (ano < 2000)
ano = "19" + ano
var dt = dia + "/" + (mes) + "/" + ano;
document.getElementById('lblPrazoSubsAns').innerHTML = "Prazo de substituição: " + dt;
}
</script>
And this is my call:
ClientScriptManager cs = Page.ClientScript;
cs.RegisterClientScriptBlock(this.GetType(), "MontaDataExclusaoPrazoANS", "montaDataSubstituicaoPrestador(calDataExclusao.Date)", true);
What happens is that nothing goes up, the label does not change. The function works, but not this way. I tried calling directly in aspx, but it did not work. Below my aspx and I do not know where to call. Just the combo code to call the function.
<table width="100%">
<tr>
<td style="width:30%; text-align:right">Motivo:</td>
<td style="width:70%"><asp:DropDownList ID="ddlMotivoExclusao" runat="server" Width="400px" OnSelectedIndexChanged="ddlMotivoExclusao_OnSelectedIndexChanged" AutoPostBack="true"></asp:DropDownList></td>
</tr>
<tr id="trDataNotificacaoExclusaoVoluntaria" runat="server" visible="false">
<td style="text-align:right">Data Notificação da Exclusão Voluntária:<span style="color:Red">*</span></td>
<td><cc1:Calendario id="calDataNotificacaoExclusaoVoluntaria" runat="server" AutoPostBack="false" /></td>
</tr>
<tr>
<td style="text-align:right">Data Exclusão:</td>
<td>
<cc1:Calendario id="calDataExclusao" runat="server" AutoPostBack="true" OnTextChanged="calDataExclusao_TextChanged" />
<asp:Label runat="server" ID="lblPrazoSubsAns">Teste:</asp:Label>
<asp:HiddenField ID="hidQtdeDiasExclusao" runat="server" />
<asp:HiddenField ID="hidIndLEI13003" runat="server" />
</td>
......