The page (whether or not it uses a master page) contains a single controls collection. It is really a control tree that you need to recurse into. You can not just loop thru one level of a collection. As an example, if you have an asp:panel on a page with a text box in it, the page's control collection will contain the panel and the panel's controls collection will contain the textbox.
Write a recursive method that accepts a control collection so that you can loop thru a single collection but recurse as needed.
<advanced suggestion>
Make the method take a delegate with Control as its single argument and you'll have a method that you can use for many things. Call delegate for each control you process and pass the control to the delegate. Then in the callback method you simply need to test the control for the type you wish to act upon and do what you want.
</advanced suggestion>
-
Peter