>Hi,
>
>If its not possible to refere to the label names with a variable. For example - Something like labeli.text = "something", then increment i by 1 and then repeat the statement - only this time labeli now becomes label2.
>
>Is there any other way i can create mutiple labels, drop down, textboxes in runtime depending on dynamic array's output and then assign all the text values of each control with a loop instead of coding them all out individually.
>
>
>Thanks for the help.
>
>Bilal.
You can instanciate an instance of a single control, set it's properties, then add that control to the form's Controls collection.
While index < 10
Dim lblDynamic As Label = New Label()
lblDynamic.Text = index.ToString()
Me.Controls.Add(lblDynamic)
index += 1
End While
You'd probably have to do this in the Page_Init. You also have to make sure you recreate the same exact controls on each page postback in order for events to fire and viewstate (if you're using it) to work correctly.
While you might get this to work, I'd think long and hard about doing it - it's easy to get this wrong and have weird errors that are hard to diagnose and/or fix.
You might be able to do what you're looking for by using something like the Repeater control.