you are on the wrong track. unless you are spinning up new threads
during a page request and those threads are adding child controls, there
is no need to use Controls.IsSynchronized.
Controls.Count is only your controls immediate count. each of its child
controls can have children. also when you test it, all the children may
not be created.
what makes you think the count is wrong?
-- bruce (sqlwork.com)
I know the count is wrong, because first of all, I used the Controls.Add()
method to add multiple Controls, so I know that there are more than 1. Also,
I did a Debug and looked at the Controls.Count property immediately before
and immediately after adding the control, and it had changed from 1 to 2.
And yet, on the next postback that same Control had a Controls.Count value
of 1 again instead of remaining at 2. This did not make since to me, so the
only possibility I could come up with (although I admit I have very little
experience with threads and synchronization, even though this is not a
multi-threaded application) was that it had something to do with all the
synchronization stuff I found while trying to find an answer. I'm totally
confused about this now. Any ideas?

Signature
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/
> you are on the wrong track. unless you are spinning up new threads during
> a page request and those threads are adding child controls, there is no
[quoted text clipped - 15 lines]
>> involved, but I had trouble understanding exactly what I need to do.
>> Could somebody please help me? Thanks.
Muhammad Naveed Yaseen - 05 Sep 2007 04:27 GMT
> And yet, on the next postback that same Control had a Controls.Count value
> of 1 again instead of remaining at 2.
Dynamically added controls do not survive post back. They need to be
added again in every postback.