Nov 24, 2009, 11:28 AM
Creating Portlet dynamically with AjaxEvents
Hi vladimir,
I am trying to create portlets dynamically as follows
If I call GetAllModules() on the Page_Load, it is working but it is not working with Button_Click - AjaxEvents
Could you please give me a suggestion in this regard?
Thank you in advance.
I am trying to create portlets dynamically as follows
public void GetAllModules()
{
using(Entities db = new Entities())
{
foreach (var modules in db.Modules.ToList())
{
Anchor ModulesAnchor = new Anchor();
Portlet ModulesPortlet = new Portlet();
ModulesPortlet.Title = modules.Name;
ModulesPortlet.ID = modules.ID.ToString();
ModulesAnchor.Items.Add(ModulesPortlet);
AnchorLayoutModules.Anchors.Add(ModulesAnchor);
}
}
}
protected void Button_Click(object sender, AjaxEventArgs e)
{
GetAllModules();
}
<ext:ScriptManager runat="server">
<Listeners>
<DocumentReady Handler="Coolite.AjaxEvent.timeout = 60000" />
</Listeners>
</ext:ScriptManager>
<Buttons>
<ext:Button ID="Button3" runat="server" Text="Click Me">
<AjaxEvents>
<Click OnEvent="Button_Click">
<EventMask ShowMask="true" />
<ExtraParams>
<ext:Parameter Name="Item" Value="One" />
</ExtraParams>
</Click>
</AjaxEvents>
</ext:Button>
</Buttons>
<ext:Portal ID="Portal1" runat="server" Title="Portal" >
<Body>
<ext:ColumnLayout ID="ColumnLayoutMain" runat="server">
<%--All Modules--%>
<ext:LayoutColumn ColumnWidth=".10">
<ext:PortalColumn Title="Modules" ID="PortalColumnModules" runat="server" StyleSpec="padding:10px 0 10px 10px" >
<Body>
<ext:AnchorLayout ID="AnchorLayoutModules" runat="server">
<ext:Anchor Horizontal="100%">
<ext:Portlet ID="Portlet2" runat="server" Title="Portlet Modules">
</ext:Portlet>
</ext:Anchor>
</ext:AnchorLayout>
</Body>
</ext:PortalColumn>
</ext:LayoutColumn>
</ext:ColumnLayout>
</Body>
</ext:Portal>
If I call GetAllModules() on the Page_Load, it is working but it is not working with Button_Click - AjaxEvents
Could you please give me a suggestion in this regard?
Thank you in advance.