Hello Mark,
As for custom composite control which contains child controls, so far I
only the following common patterns (according to the built-in ASP.NET web
server controls and the supported custom webcontrol model):
1. Do not directly embed child control type into innet properties, but use
some helper classes .e.g.
<cc1:MyComposite runat="server".........>
<subitems>
<item></item>
<item></item>
..........
</subitems>
...........
</cc1:MyComposite>
Thus, you need to set ParseChildren to true here so that those inner markup
are correctly populated as your propeties(collection) and at runtime
code(CreateChildcontrols), you construct the actual child controls
according to these helper class objects collection.
2. Directly put sub controls into your custom control's inner markup,
however, you should use template based control or GridView like control.
For exmple, you define those child controls like the Columns in GridView.
You can provide some built-in column types which has fixed control
structure at runtime, or you can provide a templatecolumn so that user can
put customize template. At runtime in CreateChildControls
3. Put "ParseChildren" as true and manually use control builder to parse
sub controls and or types.
IMO, I would proper the #1 and #2 since it will be more straighforward and
make the child control creation more clearly(in our CreateChildcontrols
code).
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx. ==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.