SaveControlState and LoadControlState events don't fire

Greetz,

I have written a web control which saves and recovers item information with the SaveControlState and LoadControlState event. This worked fine for a long time.
Now we have to surround our controls with a special border (with header items and so on in it). So I decided to create another web control which creates this special surounding borders.

The Code in the aspx page would look like this:

<wn:GroupControlsControl runat="server" ID="GroupPageOne" Height="100%" Width="720px">
<wn:GroupControlsItem ID="GroupPageOneHeaderItemLeft" runat="server" ItemAlignment=left ItemContentType=header>
headertext
</wn:GroupControlsItem>
<wn:GroupControlsItem ID="GroupPageOneHeaderItemContent" runat="server" ItemAlignment="left" ItemContentType="content">

<cc1:ObjectBrowserControl id="ObjectBrowser1" runat="server" Height="120px" PreviewImageHeight="40px" PreviewImageWidth="40px" Width="250px" />

</wn:GroupControlsItem>
</wn:GroupControlsControl>


So you see the GroupControlsControl is the Control which builds the surrounding borders and has some GroupControlsItems in it. In this case it is an other control called ObjectBrowsercontrol. And this control for example uses Load and Savecontrolstate which won't fire if it is placed inside the group control.
The Group control do nothing else but built a html table and insert all items which are between the GroupcontrolItem tags in this table.
I believe its an event problem. In order to raise Load and SavecontrolState events you have to place

base.OnInit(e);
Page.RegisterRequiresControlState(this);
if (this.Page != null)
{
Page.RegisterRequiresPostBack(this);}

in the control OnOInit Event (in this case in the ObjectbBrowsercontrol). I placed this code just for fun in the OnLoad event and vola the events fired. But of course to late. Because so the Loadcontrolsstate events fires after the LoadPostData event and thats more or less usesless. If someone has experiences with control which surrounds other controls and render the content I would be glad hearing of you.

tHx for your help so far
Thomas (CSD Austria)


Answer this question

SaveControlState and LoadControlState events don't fire