Hi,
i have a form with controls that show productinformation.
now i have 10 textboxes named tbxPrice1 -> tbxPrice10 .
in my artikecleobject exists a property list<articleprice> named articlepricelist that could have 0 till 10 elements.
now i want to fill my 10 textboxes in a loop against my articlepricelist property.
If the articlepricelist contains 3 elements, the first 3 textboxes tbxPrice1,tbxPrice2 and tbxPrice3 should be filled.
If the articlepricelist is empty, no textbox should be filled.
Has anybody an idea, how to do this ?
by jo
Dynamic control names - fill controls in loop
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
prakash kutti8 pointsPosted Jun 29, 2009, 6:32 AM EDT
for (i = 0; i < count; i++)
{
Control[] ctrls = Form1.Controls.Find("Textbox1", false);
TextBox txtbox = (TextBox)ctrls[i];
arr[i] = txtbox.Text;
}
I hope this coding helps to get values from dynamically created texboxes