[CLOSED] ASPX ---> ASCX ---> ASCX (in Windows) :: Open new Windows with dynamic ASCX

  1. #1

    [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
    <%@ 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]
  2. #2
    Hi Mario,

    I want show a modal Window that show a second ASCX control (Test) inside.
    As far as I can understand you try to show it somehow. So, what does happen with your attempt? Does it not work? Is there any error or exception thrown?

    Also I would like to recommend you to use
    <script runat="server">
    </script>
    for code behind. It would help to provide us with standalone examples which we can easily copy, paste and run without any changes from our side.

    In this case for the Page directive you should leave only the Language setting.
    <%@ Page Language="VB" %>
    Please see Example (Very Helpful) here.
    Forum Guidelines For Posting New Topics

    We would appreciate if you edit the code samples in the original post.
  3. #3
    I edited the original post.
    I await the help.
    Thanks Danill.
  4. #4
    Thank you.

    You should also render a Window.
    Protected Sub Button1_Click(sender As Object, e As Ext.Net.DirectEventArgs)
        ...
    
        Finestra.Render()
        Finestra.Show()
    End Sub
    See also
    https://examples2.ext.net/#/search/xrender
  5. #5
    Thank you Danill.
    Problem solved: you're always very helpful!

Similar Threads

  1. Replies: 14
    Last Post: Jan 21, 2014, 1:30 PM
  2. [CLOSED] How to passing DateFields from ascx to aspx file
    By Zenalyse in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 04, 2013, 2:12 PM
  3. Replies: 0
    Last Post: Jan 11, 2013, 1:57 AM
  4. Replies: 2
    Last Post: Nov 15, 2012, 12:52 AM
  5. Replies: 2
    Last Post: Apr 10, 2012, 12:08 PM

Tags for this Thread

Posting Permissions