User Control on a WebPart, PostBack / ViewState Problem


Staff member
I'm using a Sharepoint WebPart to load a UserControl which has a button that does some processing on PostBack. I got a problem: when I click the button for the first time, the data loaded on ! IsPosback gets lost, but this does not occur when I click the button again. I think my problem is explained here: <a href="" rel="nofollow noreferrer">Sharepoint Lifecycle</a>, but I haven't been able to find a workaround.

Any help would be really appreciated.

<strong>Additional Info:</strong>
I'm using EnsureChildControls on the WebPart's OnLoad event, and loading the UserControl on CreateChildControls.