I know this issue has been asked some times already since i did some research, however i couldn't still find a fix for my problem...
I have a page with dinamically created WebParts using an UpdatePanel. I create 2 WebPartZones on Page_Init and add a WebPart inside one of them... everything seems to work perfectly but when i move the WebPart from one zone to another everthing disappears so looks like the page is not saving the state of the controls added even tho i have tried enabling it on web.config and page header, i have all this on a ascx control, dont know if it has something to do:
ascx:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:WebPartManager ID="wpmPrincipal" runat="server">
</asp:WebPartManager>
</ContentTemplate>
</asp:UpdatePanel> codebehind:
protected void Page_Init(object sender, EventArgs e)
{
if (this.Page.IsPostBack == false){
this.wpmPrincipal.DisplayMode = WebPartManager.DesignDisplayMode;
WebPartZone wpz1 = configurarWebPart(new WebPartZone(), 200, 500);
wpz1.ID = "wpz1";
TextBox txtbox1 = new TextBox();
txtbox1.ID = "txtBox1";
WebPart wp1 = wpmPrincipal.CreateWebPart(txtbox1);
this.UpdatePanel1.ContentTemplateContainer.Controls.Add(wpz1);
wpmPrincipal.AddWebPart(wp1, wpz1, 0);
WebPartZone wpz2 = configurarWebPart(new WebPartZone(), 400, 300);
wpz2.ID = "wpz2";
this.UpdatePanel1.ContentTemplateContainer.Controls.Add(wpz2);
}
}
web.config pages section:
<pages enableViewState="true">
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</controls>
</pages>
i know it must be an easy problem or something i have missed up :S
thanks in advance