Feb 10, 2013, 6:27 PM
[CLOSED] [#145] Loading User Controls
I have problem loading UserControl from Javascript
For Example
For Example
<ext:Panel runat="server" ID="Panel1" Width="600" Height="300" Layout="AccordionLayout">
<Buttons>
<ext:Button runat="server" Text="Load Panels">
<Listeners>
<Click Handler ="App.direct.LoadUserControl('Panel1','AccordionPanels.ascx')"></Click>
</Listeners>
</ext:Button>
</Buttons>
</ext:Panel>
and here DirectMethod
[DirectMethod]
public static void LoadUserControl(string containerId, string userControlPath)
{
X.Js.AddScript(UserControlRenderer.ToScript(new UserControlRendrerConfig
{
UserControlPath = userControlPath,
Mode = RenderMode.AddTo,
SingleControl = true,//if false throws an error
Element = containerId,
ControlIdToRender = containerId
}));
}
and Here contents of AccordionPanels.ascx
<ext:Panel runat="server" Title="User Brown" Icon="UserBrown">
</ext:Panel>
<ext:Panel runat="server" Title="User Green" Icon="UserGreen">
</ext:Panel>
<ext:Panel runat="server" Title="User Red" Icon="UserRed">
</ext:Panel>
If SingleControl == "false" it throws an exception of control not found .I am forced to apply extra panel in my UserControl with "layout = accordion" and change layout of my Parent container "mainPanel layout =fit" but this is adding extra container for no reason.Why SingleControl = "false" throws an exception???
Last edited by Daniil; Feb 12, 2013 at 8:36 AM.
Reason: [CLOSED] [#145]