Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi
how Create TextBox dynamically and how to retrieve text box value using asp.net and c#
Posted

You create dynamic textbox (or any control) as
C#
TextBox myTextBox = new TextBox();
dynamictextbox.Text = "This is dynamically added text box";
this.Controls.Add(myTextBox);


Write this code in Page_Load.

To read value,
C#
string myTextBoxValue = myTextBox.Text;


Hope that helps
Milind
 
Share this answer
 
1>first create object of text box or any control which you want to generate control
TextBox txt = new TextBox();

2>Pass value to object
txt.Text = "This is dynamically added text box";

3>add control in page
this.Controls.Add(txt);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900