I'm trying to set a property on a custom web control before the control's CreateChildControls method is called. The reason being, a lot of logic is performed in there that depends on the value of the property in question. I can set the property directly with an explicit value in HTML and it is picked up in time, but that's no use to me because it needs to be based on a server-side variable.
The tricky bit is, that the EnsureChildControls method is being called from the getter of a "CONTENTS" property of the control which corresponds to tags within the ASPX file. e.g.;
<myControl>
<content>
...
</content>
</myControl>
As far as I know, this in turn triggers the overridden CreateChildControls method, and the logic is executed without the correct value for the property I'm trying to set.
What I'm trying to work out is, where in the ASP.NET life-cycle of my page can I set my property so that it is set before .NET accesses the getter of the "CONTENT" property of of my control?
I've tried OnPreInit on the parent page, but that still is being hit AFTER CreateChildControls on the control. I also don't want to alter the control itself, because it's a generic control and I don't want to special case it for this particular case.
Anyone got any ideas where I can set my property value so it's picked up in the order I'm trying to achieve?