Wednesday, December 13, 2006

How to implement CreateControlHierarcy in a Composite Control

There is a good article about how to implement a composite control and itexplains the usage of this method in detail.

CreateChildControls must accomplish at least the following tasks:
-Clear the Controls collection,
-Build the control's tree
-Clear the viewstate of child controls.

protected override void CreateChildControls()
//If it is not in design mode, get the posts and display them
if ((Page.Site == null) (!Page.Site.DesignMode))
else //Set design time properties
this.Width = 100;
this.Height = 10;

No comments: