Hi friend
below is your html file
<div id="TextBoxContainer">
<!--Textboxes will be added here -->
</div>
<input id="btnAdd" type="button" value="Add More" onclick="AddTextBox()" /></asp:Panel>
And below is your Javascript file
<script type="text/javascript">
function GetDynamicTextBox(value){
return '<input name = "DynamicTextBox" type="text" size="39px" value = "' + value + '" />' +
'<input type="button" value="Remove" onclick = "RemoveTextBox(this)" />'
}
var count=0;
function AddTextBox()
{
if(count<=2)
{
var div = document.createElement('DIV');
div.innerHTML = GetDynamicTextBox("");
document.getElementById("TextBoxContainer").appendChild(div);
count++;
}
}
function RemoveTextBox(div)
{
document.getElementById("TextBoxContainer").removeChild(div.parentNode);
count--;
}
function RecreateDynamicTextboxes()
{
var values = eval('<%=Values%>');
if (values != null)
{
var html = "";
for (var i = 0; i < 3; i++)
{
html += "<div>" + GetDynamicTextBox(values[i]) + "</div>";
}
document.getElementById("TextBoxContainer").innerHTML = html;
}
}
window.onload = RecreateDynamicTextboxes;
</script>
i am overconfident it will work & mark as answer, if not reply back...
Best regard
vikash pathak
Regards,
Vikash Pathak
Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator