Dynamic Cardlayout - Active panel disapears after postback from Window

  1. #1

    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:
      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
  2. #2
    Hi Everyone,

    I've tried lots of things but nothing works. I just want to keep the dynamic panel active after gridpanel reload (postback). Does anyone knows how to accomplish this?

    Thx

Similar Threads

  1. Add Dynamic panel in CardLayout
    By threewonders in forum 1.x Help
    Replies: 2
    Last Post: Jul 23, 2012, 1:29 PM
  2. [CLOSED] hiding/displaying dynamic panel on ajax postback
    By Hari_CSC in forum 1.x Legacy Premium Help
    Replies: 12
    Last Post: May 14, 2010, 10:06 AM
  3. Replies: 9
    Last Post: May 10, 2010, 5:56 AM
  4. [CLOSED] CardLayout Active Index Layout Prob
    By amitpareek in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: Jan 25, 2010, 4:28 PM
  5. DateField disapears after UP partial postback
    By ljcorreia in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Aug 06, 2009, 7:07 AM

Tags for this Thread

Posting Permissions