Sep 29, 2017, 8:12 AM
Add component after Removeall()
Hello,
I would like to delete the content of a panel and then populate it again with new data but im not able to do it. After Removeall() nothing happens.
here is a sample code:
On pageload I am creating a checkbox and a panel, when I change the Checkbox value it should delete panel 1 on panelarticulos AND load panel 2 on it. But Only deletes panel 1 and it does not create panel 2.
I know I am creating panel 2, because if I delete the RemoveAll() function, both panels are appearing.
Is there a way to do this?
.aspx
I would like to delete the content of a panel and then populate it again with new data but im not able to do it. After Removeall() nothing happens.
here is a sample code:
On pageload I am creating a checkbox and a panel, when I change the Checkbox value it should delete panel 1 on panelarticulos AND load panel 2 on it. But Only deletes panel 1 and it does not create panel 2.
I know I am creating panel 2, because if I delete the RemoveAll() function, both panels are appearing.
Is there a way to do this?
.aspx
<body>
<form id="formGeneral" runat="server">
<ext:ResourceManager ID="ResourceManagerExt" runat="server" IDMode="Explicit" />
<ext:Viewport ID="Viewport1" runat="server" Layout="columnlayout" >
<Items>
<ext:Panel ID="panelizq" runat="Server" ColumnWidth="0.25" Frame="false" Layout="ColumnLayout">
<Items>
</Items>
</ext:Panel>
<ext:Panel ID="panelarticulos" runat="Server" ColumnWidth="0.75" Frame="true" layout="columnlayout" height="500" autoscroll="true">
<Items>
</Items>
</ext:Panel>
</Items>
</ext:Viewport>
</form>
</body>
.aspx.csprotected void Page_Load(object sender, EventArgs e)
{
Ext.Net.Checkbox checkfamilia = new Ext.Net.Checkbox();
checkfamilia.ID = "check";
checkfamilia.Name = "check";
checkfamilia.BoxLabel = "reload panel";
checkfamilia.MarginSpec = "0 0 0 60";
checkfamilia.Cls = "normalbox";
panelizq.Add(checkfamilia);
checkfamilia.DirectEvents.Change.Event += new ComponentDirectEvent.DirectEventHandler(this.Filtrar);
Ext.Net.Panel panelitembehind = new Ext.Net.Panel();
panelitembehind.ID = "panel1";
panelitembehind.ColumnWidth = 0.333;
panelitembehind.Frame = true;
panelitembehind.Height = 60;
panelitembehind.Layout = "columnlayout";
panelarticulos.Add(panelitembehind);
}
public void Filtrar(object sender, DirectEventArgs e)
{
panelarticulos.RemoveAll(true);
Ext.Net.Panel panelitembehind = new Ext.Net.Panel();
panelitembehind.ID = "panel2";
panelitembehind.ColumnWidth = 0.5;
panelitembehind.Frame = true;
panelitembehind.Height = 200;
panelitembehind.Layout = "columnlayout";
panelarticulos.Add(panelitembehind);
panelarticulos.Render();
}
Thank you very much.