This "collapsible" container implements INamingContainer and exposes a public ITemplate property, which will be instantiated in the internal panel control.
As far as I know, there is nothing strange about this container, it creates its children in CreateChildrenControls() and renders its output by overriding the Render() method.
The problem is that (for some reason) CheckBoxList and RadioButtonList controls do not keep the checked state of their items when declared within the collapsible control's template (in the aspx markup).
I created a CheckBoxList descendant and implemented the IPostBackDataHandler interface to see what's received and noticed a very curious thing: the LoadPostData() method was being called even when the control was "collapsed" (innerpanel.visible := false), and the CheckBoxList was not rendered at all!
This obviously is "posting" phantom data (which happens to be blank) when the CheckboxList is not on the page, and thus clearing the checked state of the items.
Does anybody know what would cause this behavior, or how could I begin to trace what's causing it?
Thank you very much.
-dZ.
I'm not sure why this solves it, or why the problem occurred in the first place, but apparently instantiating the template on a "visible" panel guarantees that it will be processed during postback -- regardless of its actual (or eventual) visibility on the page.
Can anybody shed some light on this? I want to make sure I won't have any unintended consequences from this change.
Thank you,
-dZ.