I created the dynamic textboxes and placed in div on Webpage. But I am unable to read the text in the created textboxes. For Creating I used below code (Sample). This is my design code in .aspx
<div ID="divQtn" runat="server">
for(int i=0;i<5;i++)
{
TextBox txt = new TextBox();
txt.ID="txt"+i.ToString();
txt.Attributes.Add("runat","server");
divQtn.Controls.Add(txt);
}
For Reading text from textbox:
for(int i=0;i<5;i++)
{
string txtID = "txt"+i.ToString();
TextBox txt = (TextBox)divQtn.FindControl(txtID);
string txtData = txt.Text;
}
I am getting txt as Null.