2
I have a text control HTML which is created by a function called OnClientClick
button. The problem that every time I add a new Textbox
, the previous data are deleted.
What to do to keep him from going out?
Note: As I am creating via HTML, I can’t create asp:UpdatePanel
!
Javascript function
function novo() {
var form, quant;
if (parseInt(i) < 51) {
form = "<table width='96%' border='0'><tr><td width='8%' class='tblNormal' align='Right'>CPF:</td>"
form = form + "<td width='12%' class='tblNormal'> <input type='text' onkeypress='FiltraTecla(event);' id='cpf" + i + "' value='' size='10' maxlength='10' onblur='valorDoCampo(this.value, " + i + ")'> "
form = form + "</tr></table>"
document.getElementById('<% =qtd.ClientID %>').value = i;
i = i + 1;
formularios.innerHTML = formularios.innerHTML + form + "<br>";
}
else {
alert("Numero máximo excedido.");
}
return false;
}
post the other relevant parts of the code please
– Pedro Laini
It seems to me that the problem may be in the function valueDoCampo(), called in the input onBlur. If you can post function, it is easier to say.
– Giordano Bruno
Since Voce is using Asp.net, after running its functionVoce needs to give a false Return in Onclientclick, if there will be a post in the form. As this value does not exist in the Viewstate page is deleted.
– Paulo Alexandre