I think this problem is for the 'real' ASP diehard, but I am not sure.

In my code I declare some webserver controls form a XMl file.
Then I add them at a placeholder to put them on my webpage.

Because the control id is in the XMl file , The procedure who reads the XMl files, declares the controls, and adds them
to the plceholder. It also adds the controls at a collection.

When the user presses the 'submit' button I want to know
what values the user selected at my 'in program coded ' created controls.

First I thought it would be very easy. I just declared three
controls : a web.dropdown a web.text and a web.label
then with a for each I walk through the collection.

example

dim text as new web.ui.webcontrols.textbox
dim str as string

for each text in Objcollection

str = text.text

next

When I used this I recieved an error, for some reason a plain collection object is is not able to work with webcontrols when the added objects are all declared at the same name, only the id is different.
To solve this I use the following code :

'declaration

Dim objcollection As New Collection()

Dim objControl As New Control()

' some sub

For Each objControl In Objcollection

If TypeOf objControl Is Web.UI.WebControls.Label Then

Dim tester As Web.UI.WebControls.Label
tester = objControl
Response.Write(tester.Text)

End If

If TypeOf objControl Is Web.UI.WebControls.DropDownList Then

Dim tester As Web.UI.WebControls.DropDownList
tester = objControl

Response.Write(tester.SelectedItem.Value)


End If

Next

For some reason this works! Can anybody say if there are other more easy ways to work with webcontrol collections and there properties. The controls must be created at runtime!!

Krol