Nov 28, 2012, 8:08 AM
How to find control inside dynamic Panel with loaded Usercontrol?
Hi,
I'm trying to get a control inside of a dynamic panel that loads a usercontrol. The Control that I'm trying to find on a DirectEvent is inside the loaded usercontrol (Gridpanel). Can anyone help me? Here you can find my code:
Usercontrol:
I'm trying to get a control inside of a dynamic panel that loads a usercontrol. The Control that I'm trying to find on a DirectEvent is inside the loaded usercontrol (Gridpanel). Can anyone help me? Here you can find my code:
Usercontrol:
<ext:Label ID="LabelTitel" runat="server" Height="50" />
<ext:Hidden ID="HiddenVerplicht" runat="server" />
<ext:GridPanel ID="GridPanelSpecificatie" runat="server" Layout="FitLayout" Scroll="Vertical" AutoScroll="true" Flex="1">
<Store>
<ext:Store runat="server">
<Model>
<ext:Model runat="server" IDProperty="Id">
<Fields>
<ext:ModelField Name="Id" />
<ext:ModelField Name="Naam" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:Column runat="server" DataIndex="Naam" Flex="1" Border="false" />
</Columns>
</ColumnModel>
<SelectionModel>
<ext:CheckboxSelectionModel ID="CheckboxSelectionModel_GridPanelSpecificatie" runat="server">
<Listeners>
<SelectionChange Fn="GridPanelSpecificatie_SelectionChange" />
</Listeners>
</ext:CheckboxSelectionModel>
</SelectionModel>
</ext:GridPanel>
Dynamic Panel Load + Usercontrol (recreated every page load): foreach (var Specificatie in AlleSpecificaties)
{
// control - gridpanel
var CtrlSpecificatie = this.LoadControl("~/controls/gridpanels/specificatie_gridpanel.ascx") as specificatie_gridpanel;
CtrlSpecificatie.ID = "CtrlSpecificatie_" + Specificatie.Id;
CtrlSpecificatie.Specificatie = Specificatie;
CtrlSpecificatie.Titel = "<h1>[Stap " + iStap + "] - Selecteer de product specificaties - " + Specificatie.Naam + ".</h1>";
// panel
var PanelSpecificatie = new Panel();
PanelSpecificatie.ID = "PanelSpecificatie_" + Specificatie.Id;
PanelSpecificatie.BodyPadding = 10;
PanelSpecificatie.Layout = "VBoxLayout";
PanelSpecificatie.LayoutConfig.Add(new VBoxLayoutConfig { Pack = BoxPack.Start, Align = VBoxAlign.Stretch });
PanelSpecificatie.ContentControls.Add(CtrlSpecificatie);
PanelSpecificatie.Listeners.Activate.Fn = "SpecificatiesWizardPanel_Activatie";
PanelSpecificatie.AddTo(PanelStappenWizard);
// controle
if (Specificaties.Distinct().Contains(Specificatie))
{
CtrlSpecificatie.Titel += " - boe";
iStap++;
}
else
{
PanelStappenWizard.Remove(PanelSpecificatie);
}
//PanelStappenWizard.Items.Add(PanelSpecificatie);
}
PanelStappenWizard.DoLayout();
Panel - Cardlayout (steps):<ext:Panel runat="server" Title="Details - Stappen" ID="PanelStappenWizard" Icon="ApplicationCascade" Layout="CardLayout" ActiveIndex="0" Flex="1" BodyPaddingSummary="10 0 0 0" Frame="true">
<Items>
<%-- stap 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>[Stap 1] - Selecteer de categorie(en).</h1>" Height="50" />
</Items>
</ext:Panel>
<%-- stap 2 --%>
<ext:Panel ID="Panel2" runat="server" BodyPadding="10" Layout="VBoxLayout">
<LayoutConfig>
<ext:VBoxLayoutConfig Align="Stretch" Pack="Start" />
</LayoutConfig>
<Items>
<ext:Label ID="Label3" runat="server" Html="<h1>[Stap 2] - Is dit een nieuw product?</h1>" Height="50" />
</Items>
</ext:Panel>
<%-- stap 3 --%>
<ext:Panel ID="Panel3" runat="server" BodyPadding="10" Layout="VBoxLayout">
<LayoutConfig>
<ext:VBoxLayoutConfig Align="Stretch" Pack="Start" />
</LayoutConfig>
<Items>
<ext:Label ID="Label4" runat="server" Html="<h1>[Stap 3] - Selecteer het merk uit de lijst.</h1>" Height="50" />
</Items>
</ext:Panel>
<%-- stap 4 --%>
<ext:Panel ID="Panel4" runat="server" BodyPadding="10" Layout="VBoxLayout">
<LayoutConfig>
<ext:VBoxLayoutConfig Align="Stretch" Pack="Start" />
</LayoutConfig>
<Items>
<ext:Label ID="Label5" runat="server" Html="<h1>[Stap 4] - Geef het product eventueel een naam en/of omschrijving.</h1>" Height="50" />
</Items>
</ext:Panel>
</Items>
</ext:Panel>