Showing posts with label JavaScript. Show all posts
Showing posts with label JavaScript. Show all posts

Saturday, September 20, 2014

How to Retrive Dynamically Generated Textboxes values using JavaScript in Asp.Net

After generating texboxes dynamically as shown in my previous artical(ClickHere to see) it is the time to retrive values of textboxes entered by the user .

In .aspx Page 

In continuation of my previous artical (ClickHere to see) add following html code in your page


 <asp:Button runat="server" ID="btnGetValues" Text="GetValues" OnClick="btnGetValues_Click" />

Adding Textbox Dynamically Using JavaScript in Asp.Net

Adding Textboxes Dynamically using Javascript is very easy in Asp.Net

In .aspx page

Add following javascript in Head Section of your page 

 function GetDynamicTextBox() 
{
            return 'TextBox1:<input name = "txt1" style="width:200px" type="text" />'+
            'TextBox2:<input name = "txt2" type="text" style="width:200px" />' +
            '<input type="button" value="Remove"  class="button"  onclick = "RemoveTextBox(this)" />'
 }