Sep 23, 2011, 6:45 AM
[CLOSED] Problem opening a Window that contains UserControl
My goal is to open a new modular popup window that will fill up the screen, and inside is based on whatever ASCX file. But somehow the popup window is always empty. Can you advice if my implementation is wrong, or if there is a better way to do this? I wanted to use window so its modular and still inside my main page.
Main Page:
Main Page:
<ext:Panel ID="Panel1" runat="server" Border="false" ButtonAlign="Right">
<Items>
<ext:Button ID="Button1" runat="server" Text="Print">
<DirectEvents>
<Click OnEvent="DE_Window" Before="getScreenSize(this, extraParams)">
<ExtraParams>
<ext:Parameter Name="ScreenWidth" Value="Ext.getBody().getViewSize().width" Mode="Raw" />
<ext:Parameter Name="ScreenHeight" Value="Ext.getBody().getViewSize().height" Mode="Raw" />
</ExtraParams>
</Click>
</DirectEvents>
</ext:Button>
</Items>
</ext:Panel>
<ext:Window ID="Window1" runat="server" Title="Report" Icon="Printer" Hidden="true"
Height="480px" Width="640px"
Padding="5" Collapsible="true" Modal="true">
<Items></Items>
</ext:Window>
Main Page (Code Behind)public void DE_Window(object sender, DirectEventArgs e)
{
UserControl ucUserControl;
ucUserControl = (UserControl)this.LoadControl("UserControl.ascx");
ucUserControl.ID = "UserControl_ID";
this.Window1.ContentControls.Add(ucUserControl);
int height = 0; int.TryParse(e.ExtraParams["ScreenHeight"], out height);
int width = 0; int.TryParse(e.ExtraParams["ScreenWidth"], out width);
if (height > 0) this.Window1.Height = new Unit(height);
if (width > 0) this.Window1.Width = new Unit(width);
this.Window1.Show();
}
UserControl.ascx<div>This is a user control</div>
Thanks, J
Last edited by geoffrey.mcgill; Sep 26, 2011 at 3:52 AM.
Reason: [CLOSED]