Web Form Designer is deleting the markup for child colleciton of custom server control

I am trying to implement a custom server control which exposes a collection
and uses the ParseChildrenAttribute to populate it from child elements of
the controls aspx markup.  In fact I am simply starting with Microsoft's
"ParseChildrenAttribute Sample".  I have made no changes to this sample and
am having the following problem.  If I change any property (Visible for
instance) of the custom control (CollectionPopertyControl in the case of the
sample) using the Properties Window of the Web Form Designer, the aspx
markup for the collection is deleted as follows:

What was orriginally:

<Custom:CollectionPropertyControl Header = "Employees" id = "prop" runat =
"server">
<Custom:Employee Name = "Alice" Alias = "AliceA" Title = "Manager" />
<Custom:Employee Name = "Jerry" Alias = "JerryR" Title = "Programmer" />
<Custom:Employee Name = "Lynn" Alias = "LynnP" Title = "Architect" />
<Custom:Employee Name = "Mike" Alias = "MikeB" Title = "Tester" />
</Custom:CollectionPropertyControl>

becomes:
   <Custom:CollectionPropertyControl Header="Employees" id="prop"
runat="server" Visible="False"></Custom:CollectionPropertyControl>

How do I stop this from happening?  I don't really need the collection to be
editable from the web for designer.  I am happy to maintain the values by
editing the markup, BUT I do need the markup to survive the control's basic
properties being manipulated by the designer.  I have tried seting the
collection property's Browsable attribute to false but that did not solve
the problem.

Suggestions?

LVL 1
kbaltrinicAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

raterusCommented:
Have you checked the source of other custom controls that have child controls, to see what they've done?  I'm sure there's some attribute you need to add to fix this.  I checked the reflector, namely on a DropDownList to see what attributes the Items Collection had.  The "PersistenceMode" attribute seems like a potential candidate to investigate.

<PersistenceMode(PersistenceMode.InnerDefaultProperty), WebCategory("Default"), DefaultValue(CType(Nothing, String)), MergableProperty(False), WebSysDescription("ListControl_Items")>      

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kbaltrinicAuthor Commented:
Kudos that works.  I spent all day off and reading up on "enhancing design-time support" and never saw any mention of that attribute.  My guess was it was an attribute.  Reflecting on a microsoft object occured to me but seems in all the distrations around here I never got to trying that.

Tall me this "relector" is this a utillity or something?  I was going to code up a quick console app to spit out the data.  It would be really handy if the object browser provided this sort of information.
kbaltrinicAuthor Commented:
Oh dear I was typing really fast.  Appologies for all the typos.  You would never know I was a native English speaker.
raterusCommented:
http://www.aisto.com/roeder/dotnet/
Decompiler / Class viewer for any .net assembly, including the framework dll's.  You'll like :-)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.