PDA

View Full Version : [CLOSED] Load Ext.NET component programmatically



Daly_AF
Jul 11, 2012, 4:20 PM
Hi,

I implemented an action to load a panel programmatically but the panel doesn't appear this is the code bellow to reproduce the problem :



<ext:Panel ID="_pnl" runat="server" Flex="1" Layout="Fit" Width="250" Region="West"
Collapsible="true">
<Loader runat="server" DisableCaching="true" Url="/ViewEngine/Load" Mode="Component">
<Params>
<ext:Parameter Name="containerID" Value="_pnl" Mode="Value" />
</Params>
<Listeners>
<Load Handler="eval(response.responseText);" />
</Listeners>
</Loader>
</ext:Panel>




public ContentResult Load(String containerID)
{
var contentResult = new ContentResult();
Panel p = new Panel("Title");
p.Height = 200;
p.Html = "Hello World";
contentResult.Content = string.Format("<script>{0}</script>", p
.ToScript(RenderMode.AddTo, containerID));
return contentResult;
}


Thank you in advance.

Daniil
Jul 11, 2012, 5:49 PM
Hi,

Please use the ComponentLoader. Similar to this.
http://forums.ext.net/showthread.php?19603&p=84459&viewfull=1#post84459

You can pass the Ext.NET components to the ToConfig method.

Daly_AF
Jul 11, 2012, 7:51 PM
Hi,

Please use the ComponentLoader. Similar to this.
http://forums.ext.net/showthread.php?19603&p=84459&viewfull=1#post84459

You can pass the Ext.NET components to the ToConfig method.

I would pass parameters within Loader request.

Daly_AF
Jul 11, 2012, 8:39 PM
I would pass parameters within Loader request.

It solved we should setup this :


<Loader runat="server" DisableCaching="true" Url="/ViewEngine/LoadWestMenu" Mode="Html"
Scripts="true">
<Loader runat="server" DisableCaching="true" Url="/ViewEngine/Load" Mode="Html">
<Params>
<ext:Parameter Name="containerID" Value="_pnl" Mode="Value" />
</Params>
</Loader>
</ext:Panel>