Part of the series of controls I'm working on obviously suggests that I put some of them together in composites. I quickly start to find out that this takes into account (this is all new to me!) :)
I basically have a control StyledWindowthat is essentially illustrious Panelwith the ability to make other bits (e.g. add borders, etc.).
Here is the code that creates the child controls in it. Up to this point, it seems to have worked correctly with ordinary static controls:
protected override void CreateChildControls()
{
_panel = new Panel();
if (_editable != null)
_editable.InstantiateIn(_panel);
_regions = new List<IAttributeAccessor>();
_regions.Add(_panel);
}
Problems arose today when I tried to put a more complex control into it. This control uses a page link as it introduces JavaScript to make it faster and more responsive (which RegisterClientScriptBlockis the only reason I need a page link).
Now this caused an "object null" error, but I localized it to a rendering method, which, of course, tried to call the method against the [null] object Page.
What bothers me is that the control works fine, as stand-alone, but when it is placed in StyledWindow, everything goes horribly wrong!
So it looks like I'm missing something in mine StyledWindowor ChildControl. Any ideas?
Update
, , Controls. , _panel, , Controls ( -):
Panel _panel;
public override ControlCollection Controls
{
get
{
EnsureChildControls();
return _panel.Controls;
}
}
, . .
, , . .
, , . , , . OnLoad ! , , , , , - - , ? ? (, , ?!): D
, , :)