In my custom control I have overriden CreateChildControls and the first few
lines look like this.

protected override void CreateChildControls()
{
Debug.WriteLine("CreateChildControls", "FeatureList");
Controls.Clear();
..
}

what I am seeing is that the Controls.Clear line indirectly calls
CreateChildControls (the call is through a Get on the Controls collection
from the stack).

Although the controls end up being right, they are created twice which is
hardly efficient. What do I need to do to stop this happening?

Iain
--
Iain Downs (DirectShow MVP)
Commercial Software Therapist
www.idcl.co.uk

Re: Recursion in CreateChildControls by Iain

Iain
Sun Feb 26 10:12:10 CST 2006

On Sun, 26 Feb 2006 14:42:18 +0000, Iain wrote:

> In my custom control I have overriden CreateChildControls and the first few
> lines look like this.
>
> protected override void CreateChildControls()
> {
> Debug.WriteLine("CreateChildControls", "FeatureList");
> Controls.Clear();
> ..
> }
>
> what I am seeing is that the Controls.Clear line indirectly calls
> CreateChildControls (the call is through a Get on the Controls collection
> from the stack).
>
> Although the controls end up being right, they are created twice which is
> hardly efficient. What do I need to do to stop this happening?
>
> Iain

What a stupid place to post an ASP.NET question. My apologies.

Iain
--
Iain Downs (DirectShow MVP)
Commercial Software Therapist
www.idcl.co.uk