Hi,
I have a situation where I need to show data from database to textboxes. These textboxes has to be dynamically created and can be editable. I am able to create textboxes as follows:
public void showData()
{
for (int i = 0; i < myData.Length; i++)
{
if (txtMore.FindControl("txtD1StartTime" + i) == null)
{
txtStart1 = new TextBox();
lblStart1 = new Label();
txtStart1.ID = "txtD1S" + i;
lblStart1.ID = "lblD1S" + i;
txtStart1.Text = myData[i].ToString();
lblStart1.AssociatedControlID = txtStart1.ID;
lblStart1.Text = "Data" + i;
txtMore.Controls.Add(lblStart1);
txtMore.Controls.Add(txtStart1);
}
}
}
In my ascx page, I am loading those textboxes in
as follows:
Go to the complete details ...