I'm building a composite web control that includes a number of
composed child controls with unbounded multiplicity. I'd like to add
"add new thing" and "remove this thing" buttons to my control, to add
and delete composed controls from the control, but I'm not sure how to
go about this.
I was thinking I could keep a count of the number of composed controls
of a particular type in the ViewState, and simply create that many
controls in the CreateChildControls() method of my control. However,
it occurs to me that it would not be possible to delete controls
randomly from these children, since the ViewState for these controls
would become unsyncronised when trying to recreate them.
Is there a standard means of achieving this? I can't find any examples
of dynamic composite controls that create and delete children in this
way. Pointers to examples would be great.