Ajax Dynamic Text Box Creation

Step 1 :
Create Webpage.aspx

Step 2 :
Add ScriptManger into your Page.
< asp:ScriptManager ID="ScriptManager1" runat="server" >
< / asp:ScriptManager>

Step 3:
Create one HTML Div as its id as "DynamicTextBox"
and two button which id as "btnClient" , value as "Client Value" and id as "btnResult" , value as "Result"
and one span which id as "Result"
and one asp:hiddenfield as "hfCount"

the code is like as

< div id="DynamicTextBox">

< input id="btnClient" type="button" value="Client Value" />
< input id="btnResult" type="button" value="Result" onclick =" returnResults();" />
< span id="Result">
< asp: HiddenField ID="hfCount" runat="server" Value="1" />

Step 4 :
add the Script inside the head tag as
< script type ="text/javascript">
function page_load (sender, e) {
var btnClientClick = Function.createDelegate(this, OnBtnClientClick);
$addHandler($get("btnClient"), "click", btnClientClick);
}
function page_unload (sender, e) {
}
function OnBtnClientClick () {
var DivObj = $get("DynamicTextBox");
var IdVal = ($get("hfCount").value - 1) + 2;
$get("hfCount").value = IdVal;
DivObj.innerHTML = DivObj.innerHTML + "< input id="txt" + IdVal + "" type="text" value="txt" + IdVal + "" />";
}
function returnResults () {
var count = parseInt($get("hfCount").value) + 1;
for (var i = 2; i < count; i++) { $get("Result").innerHTML = $get("Result").innerHTML + $get("txt" + i).value; } }

Step 5 :
Add this script at the bottom of the form tag.

< script type="text/javascript">
Sys.Application.add_load(page_load);
Sys.Application.add_unload(page_unload);
< / script>

Now Run