views:

30

answers:

2

I'm writing a set of C# composite web server controls for displaying dialog boxes.

I want to have one abstract class which handles the basic layout and things like titles of the control, then have a set of derived ones which render child controls at a specific point.

I forsee three distincts methods: renderOpeningHtml handled by the abstract class, renderCustomControls as done by the derived class, and renderClosingHtml by the abstract class again, except I can't figure the life cycle of a CompositeControl and what methods to use when.

A: 

Never mind, figured it.

Used public override void RenderBeginTag(HtmlTextWriter writer) and RenderEndTag for the abstract control, and RenderContents for the derivatives.

mattdwen
A: 

If you don't have to do your own HTML rendering you could also consider deriving from UserControl and just adding to your Controls collection. The word "composite" seems to point in that direction.

Evgeny
Yeah, I'm put a bit of html in there.
mattdwen