Nov 27, 2012, 11:07 AM
Dynamic Cardlayout - Active panel disapears after postback from Window
Hi Everyone,
I'm struggling to get my panel with cardlayout to work correctly. Inside my panel i have a few base panels (steps) and expand this after some options are choosing. So far so good. But now I call a Model Window, and on close i recreate the dynamic panels, but i see that my active item from the card layout disappears, and nothing is shown. When i try to set the activeindex of the Wizard, I'm stuck in a postback loop.
Page Load - recreate dynamic panels:
Window Close DirectEvent:
Markup Cardlayout Panel:
Markup Window:
I'm struggling to get my panel with cardlayout to work correctly. Inside my panel i have a few base panels (steps) and expand this after some options are choosing. So far so good. But now I call a Model Window, and on close i recreate the dynamic panels, but i see that my active item from the card layout disappears, and nothing is shown. When i try to set the activeindex of the Wizard, I'm stuck in a postback loop.
Page Load - recreate dynamic panels:
protected void Page_Load(object sender, EventArgs e)
{
PanelSpecificationsLoad();
}
add/remove dynamic panels after the existing ones:
private void PanelSpecificationsLoad()
{
// init
List<Specification> AllSpecifications = LoadAllSpecification();
List<Specification> Specifications= new List<Specification>();
int iStep = PanelStepWizard.Items.Count + 1;
if (TreePanelCategories.CheckedNodes != null)
{
foreach (var node in TreePanelCategories.CheckedNodes)
{
var Category = LoadCategoryById(Helper.ToInt(node.NodeID));
if (Category != null)
{
var MainCategory= LoadCategoryById(Helper.ToInt(Category.MainCategoryId));
if (MainCategory!= null)
{
Specifications.AddRange(MainCategory.Specifications);
}
}
}
}
foreach (var Specification in AllSpecifications)
{
// control - gridpanel
var CtrlSpecification = this.LoadControl("~/controls/gridpanels/specification_gridpanel.ascx") as specification_gridpanel;
CtrlSpecificatie.ID = "CtrlSpecificatie_" + Specificatie.Id;
CtrlSpecificatie.Specification = Specification;
CtrlSpecificatie.Title = "<h1>[Step" + iStap + "] - Select - " + Specification.Name + ".</h1>";
// panel
var PanelSpecification= new Panel();
PanelSpecification.ID = "PanelSpecification_" + Specification.Id;
PanelSpecification.BodyPadding = 10;
PanelSpecification.Layout = "VBoxLayout";
PanelSpecification.LayoutConfig.Add(new VBoxLayoutConfig { Pack = BoxPack.Start, Align = VBoxAlign.Stretch });
PanelSpecification.ContentControls.Add(CtrlSpecification );
PanelSpecification.Listeners.Activate.Fn = "SpecificationWizardPanel_Activate";
PanelSpecification.AddTo(PanelStappenWizard);
// check
if (CtrlSpecifications.Distinct().Contains(CSpecification))
{
iStap++;
}
else
{
PanelStepsWizard.Remove(PanelSpecification);
}
}
PanelStepsWizard.DoLayout();
//PanelStepsWizard.ActiveIndex = Helper.ToInt(HiddenActiveIndex.Value);
}
Window Close DirectEvent:
protected void WindowAddItems_Close(object sender, DirectEventArgs e)
{
// Do Something
}
Markup Cardlayout Panel:
<ext:Panel runat="server" Title="Details - Stappen" ID="PanelStepsWizard" Icon="ApplicationCascade" Layout="CardLayout" ActiveIndex="0" Flex="1" BodyPaddingSummary="10 0 0 0" Frame="true">
<Items>
<%-- step 1 --%>
<ext:Panel ID="Panel1" runat="server" BodyPadding="10" Layout="VBoxLayout">
<LayoutConfig>
<ext:VBoxLayoutConfig Align="Stretch" Pack="Start" />
</LayoutConfig>
<Items>
<ext:Label ID="Label1" runat="server" Html="<h1>[Step 1]</h1>" Height="50" />
</Items>
<Listeners>
<Activate Fn="CategorieenWizardPanel_Activatie" />
</Listeners>
</ext:Panel>
<%-- step 2 --%>
<ext:Panel ID="Panel2" runat="server" BodyPadding="10" Layout="VBoxLayout">
<LayoutConfig>
<ext:VBoxLayoutConfig Align="Stretch" Pack="Start" />
</LayoutConfig>
<Items>
<ext:Label ID="Label2" runat="server" Html="<h1>[Step 2] </h1>" Height="50" />
</Items>
<Listeners>
<Activate Fn="NieuwProductWizardPanel_Activatie" />
</Listeners>
</ext:Panel>
<%-- step 3 --%>
<ext:Panel ID="Panel3" runat="server" BodyPadding="10" Layout="VBoxLayout">
<LayoutConfig>
<ext:VBoxLayoutConfig Align="Stretch" Pack="Start" />
</LayoutConfig>
<Items>
<ext:Label ID="Label3" runat="server" Html="<h1>[Step 3]</h1>" Height="50" />
</Items>
<Listeners>
<Activate Fn="MerkenWizardPanel_Activatie" />
</Listeners>
</ext:Panel>
<%-- step 4 --%>
<ext:Panel ID="Panel4" runat="server" BodyPadding="10" Layout="VBoxLayout">
<LayoutConfig>
<ext:VBoxLayoutConfig Align="Stretch" Pack="Start" />
</LayoutConfig>
<Items>
<ext:Label ID="Label4" runat="server" Html="<h1>[Step 4]</h1>" Height="50" />
</Items>
<Listeners>
<Activate Fn="NaamWizardPanel_Activatie" />
</Listeners>
</ext:Panel>
</Items>
</ext:Panel>
Markup Window:
<ext:Window ID="WindowAddItems" runat="server" Width="980" Height="680"
AutoShow="false" Modal="true" Hidden="true" Layout="FitLayout" ButtonAlign="Right">
<Loader runat="server" Mode="Frame" AutoLoad="false">
<LoadMask ShowMask="true" />
</Loader>
<DirectEvents>
<Close OnEvent="WindowAddItems_Close">
<EventMask ShowMask="true" />
</Close>
</DirectEvents>
<Buttons>
<ext:Button runat="server" Icon="Cross" Text="Close">
<Listeners>
<Click Handler="#{WindowAddItems}.close();" />
</Listeners>
</ext:Button>
</Buttons>
</ext:Window>
Last edited by Nesse; Nov 27, 2012 at 11:10 AM.
Reason: formatting code