Getting Type of Control

Pizzor2000

Newcomer
Joined
Jul 12, 2004
Messages
11
Is there a way to find out the type of a given control on an ASP form? For instance, I'm going through each of the controls on a form, and I want to know if it's a text box, select list, or whatever.
 
wessamzeidan said:
you can use typeof, for example

if typeof ctrl is textbox then

'your code

end if

Right now, my loops through a collection of controls, as such:
Code:
Dim coll as NameValueCollection

coll = HttpContext.Current.Request.Form

For i = 0 to coll.Count - 1
     'Do something to each control.
Next i

Does the NameValueCollection allow me to get the control variables? If not, is there a better way to loop through each control on the form?
 
Back
Top