Dec 06, 2014, 8:51 AM
[CLOSED] ASPX ---> ASCX ---> ASCX (in Windows) :: Open new Windows with dynamic ASCX
Hi,
I have an ASPX page (WebForm1) that loads dinamically a ASCX control (WebUserControl1).
In this ASCX (WebUserControl1), I want show a modal Window that show a second ASCX control (Test) inside.
Can you help me?
The code:
WebForm1.aspx
WebUserControl1.ascx
Test.ascx
If you run the code and click on "GO !" it should show a modal window with the label "Hello World !" ... but nothing appears.
I have an ASPX page (WebForm1) that loads dinamically a ASCX control (WebUserControl1).
In this ASCX (WebUserControl1), I want show a modal Window that show a second ASCX control (Test) inside.
Can you help me?
The code:
WebForm1.aspx
<%@ Page Language="vb" %>
<%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
<script runat="server">
Protected Sub Page_Load(sender As Object, e As EventArgs)
Dim Applicazione As New Ext.Net.UserControlLoader
Applicazione.ID = "Applicazione1"
Applicazione.Path = "WebUserControl1.ascx"
PanelApplicazione.Items.Clear()
PanelApplicazione.Items.Add(Applicazione)
End Sub
</script>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager runat="server" ID="ResourceManager1" />
<ext:Viewport runat="server" ID="Viewport1">
<LayoutConfig>
<ext:VBoxLayoutConfig Align="Center" />
</LayoutConfig>
<Items>
<ext:Panel ID="PanelApplicazione" runat="server" Flex="1" Width="1000" Border="false" PaddingSpec="5 0 5 0" Layout="FitLayout" />
</Items>
</ext:Viewport>
</form>
</body>
</html>
WebUserControl1.ascx
<%@ Control Language="vb" %>
<script runat="server">
Protected Sub Button1_Click(sender As Object, e As Ext.Net.DirectEventArgs)
Dim Controllo As New Ext.Net.UserControlLoader
Controllo.ID = "Test1"
Controllo.Path = "Test.ascx"
Dim Finestra As New Ext.Net.Window
Finestra.ID = "FinestraTest1"
Finestra.Items.Add(Controllo)
Finestra.Show()
End Sub
</script>
<ext:Panel ID="Panel1" runat="server">
<Items>
<ext:Button runat="server" ID="Button1" IDMode="Static" Text="GO !">
<DirectEvents>
<Click OnEvent="Button1_Click" />
</DirectEvents>
</ext:Button>
</Items>
</ext:Panel>
Test.ascx
<%@ Control Language="vb" %>
<ext:Panel ID="Panel1" runat="server" >
<Items>
<ext:Label runat="server" ID="Label1" Text="Hello World !" />
</Items>
</ext:Panel>
If you run the code and click on "GO !" it should show a modal window with the label "Hello World !" ... but nothing appears.
Last edited by Daniil; Dec 08, 2014 at 2:28 PM.
Reason: [CLOSED]