markiz
markiz

Reputation: 2184

Composite controls: Render vs CreateChildControls

I am learning creating Composite controls with UI design-time support.

There are 2 ways to implement it:
Overriding Render - and in this case open and close html tags.
Overriding CreateChildControls - and in this case create controls with their properties and add them to control collection.

Which one is better and efficient?

Upvotes: 2

Views: 2219

Answers (1)

Mike J
Mike J

Reputation: 1154

Here is a good article that answers your question A Crash Course on ASP.NET Control Development: Building Composite Controls.

The summary is to use Render for read-only controls, nothing interactive. Use CreateChildControls for anything that requires event handling or posted data.

Upvotes: 4

Related Questions