S
Scott A
I have an aspx page that has many nested controls. For example I have
Panels that contain text boxes. There is also text boxes on the page
itself. I'd like to loop through every control on the page and build a
collection of those controls that interest me (in this case the text
box controls). I can get at the controls by doing:
foreach (Control c in this.Controls)
As I come accross those controls I want I'd like to add them to my new
control collection. I've tried creating a new collection like this:
System.Web.UI.ControlCollection cc = CreateControlCollection();
Everytime I try to add a control to this collection I get this error:
"The list that this enumerator is bound to has been modified. An
enumerator can only be used if the list doesn't change."
How can I create a control collection that I can add controls to?
TIA,
Scott
Panels that contain text boxes. There is also text boxes on the page
itself. I'd like to loop through every control on the page and build a
collection of those controls that interest me (in this case the text
box controls). I can get at the controls by doing:
foreach (Control c in this.Controls)
As I come accross those controls I want I'd like to add them to my new
control collection. I've tried creating a new collection like this:
System.Web.UI.ControlCollection cc = CreateControlCollection();
Everytime I try to add a control to this collection I get this error:
"The list that this enumerator is bound to has been modified. An
enumerator can only be used if the list doesn't change."
How can I create a control collection that I can add controls to?
TIA,
Scott