create window from within another window

  1. #1

    create window from within another window



    Is it possible to create a window from a buttonfield in a gridview of another window but tie it to the viewport?

    I have a main page simplified:
    <html>
    <head runat="server">
      <title>BICSI Vantage</title>
      <link rel="stylesheet" href="css/style.css" type="text/css" />
    </head>
    <body>
      <ext:ScriptManager ID="ScriptManager1" runat="server" Theme="Gray" Hide="true">
        <Listeners>
          <DocumentReady Fn="Ext.get('lnkHome').on('click', function() { winHome.show(); });"/>
        </Listeners>
      </ext:ScriptManager>
      <form id="MainForm" runat="server">
      
      <ext:ViewPort ID="ViewPort1" runat="server">
        <Content>
          <ext:BorderLayout ID="BorderLayout1" runat="server">
            <North Collapsible="True" Split="True">
              <ext:Panel ID="NorthPanel" runat="server" Height="95" Title="Header" Header="False">
                <Content>
                  <ext:Accordion ID="WestAccordion" runat="server" Animate="true" TitleCollapse="true">
                    <ext:Panel ID="Favorites" runat="server" Title="Favorites" Border="false" BodyStyle="padding:6px;" Icon="Star">
                      <Content>
                        <ul>
                          <li class="findindividual"><a href="#" id="lnkInd">Find Individual</a></li>
                        </ul>
                      </Content>
                    </ext:Panel>
                  </ext:Accordion>
                </Content>
              </ext:Panel>
            </North>
          </ext:BorderLayout>
        </Content>
      </ext:ViewPort>
      <ext:Window ID="winInd" Show&#111;nload="false" Icon="User" Minimizable="true" runat="server" Collapsible="true" Title="Individual" AutoLoad="http://localhost:3077/BICSI-Vantage2...ndividual.aspx" Width="800" Height="800" CloseAction="Hide">
      </ext:Window>
      
    
      </form>
    </body>
    </html>
    and a window with a bunch of tabs with gridviews simplified:
    <script runat="server">
     protected void RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "showInv")
            {
                Window win = new Window(); 
                win.Title = "Invoice";
                win.AutoLoad = "http://localhost:3077/BICSI-Vantage2...s/invoice.aspx"; 
                this.form1.Controls.Add(win);    
            }
        }
    </script>
    
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>BICSI Vantage</title>
        <link rel="stylesheet" href="../../css/style.css" type="text/css" />
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager2" runat="server" LoadScriptsBeforeUI="False">
        </asp:ScriptManager>
        <ext:ScriptManager ID="ScriptManager1" runat="server" Theme="Gray" Hide="true">
        </ext:ScriptManager>
        
            <ext:ViewPort ID="ViewPort1" runat="server">
                <Content>
                    <ext:BorderLayout ID="BorderLayout1" runat="server">
                        <Center>
                            <ext:Panel ID="Panel7" runat="server" Title="Result">
                                <Content>
                                    <ext:FitLayout ID="FitLayout2" runat="server">
                                        <ext:TabPanel ID="TabPanel2" runat="server" ActiveTab="2" Border="false" 
                                            Title="Center">
                                            <Tabs>
                                                <ext:Tab ID="InvoicesTab" runat="server" Title="Invoices">
                                                    <Content>
                                                        <asp:UpdatePanel ID="UpdatePanel9" runat="server">
                                                            <ContentTemplate>
                                                                <asp:GridView ID="GridView5" runat="server" AllowSorting="True" AutoGenerateColumns="False"
                                                                    DataSourceID="LinqDataSource3" OnRowCommand="RowCommand">
                                                                    <Columns>
                                                                        <asp:BoundField DataField="INVOICENUM" HeaderText="Inv #" ReadOnly="True" SortExpression="INVOICENUM" />
                                                                        <asp:BoundField DataField="INVOICESTT" HeaderText="Inv Status" ReadOnly="True" SortExpression="INVOICESTT" />
                                                                        <asp:BoundField DataField="INVOICEDATE" HeaderText="Inv Date" ReadOnly="True" SortExpression="INVOICEDATE" />
                                                                        <asp:BoundField DataField="DUEDATE" HeaderText="Due Date" ReadOnly="True" SortExpression="DUEDATE" />
                                                                        <asp:BoundField DataField="TOTALAMT" HeaderText="Total Amt" ReadOnly="True" SortExpression="TOTALAMT" />
                                                                        <asp:BoundField DataField="BALANCEDUE" HeaderText="Bal. Due" ReadOnly="True" SortExpression="BALANCEDUE" />
                                                                        <asp:BoundField DataField="PAIDFLG" HeaderText="Paid" ReadOnly="True" SortExpression="PAIDFLG" />
                                                                        <asp:BoundField DataField="PAYMENTNUM" HeaderText="Pay #" ReadOnly="True" SortExpression="PAYMENTNUM" />
                                                                        <asp:BoundField DataField="PAYMENTDATE" HeaderText="Pay Date" ReadOnly="True" SortExpression="PAYMENTDATE" />
                                                                        <asp:BoundField DataField="ORDERSOURCE" HeaderText="Source" ReadOnly="True" SortExpression="ORDERSOURCE" />
                                                                        <asp:BoundField DataField="SOURCECD" HeaderText="Source CD" ReadOnly="True" SortExpression="SOURCECD" />
                                                                        <asp:ButtonField CommandName="showInv"  HeaderText="InvNum" 
                                                                            InsertVisible="False" ShowHeader="True" DataTextField="INVOICENUM" />
                                                                    </Columns>
                                                                </asp:GridView>
                                                                <asp:LinqDataSource ID="LinqDataSource3" runat="server" ContextTypeName="CV2DataContext"
                                                                    TableName="INVOICE2s" Where="PAYEECD == @PAYEECD" Select="new (INVOICENUM, INVOICESTT, INVOICEDATE, DUEDATE, PRICEAMT, TOTALAMT, BALANCEDUE, PAIDFLG, PAYMENTNUM, PAYMENTDATE, ORDERSOURCE, SOURCECD)">
                                                                    <WhereParameters>
                                                                        <asp:ControlParameter ControlID="GridView3" Name="PAYEECD" PropertyName="SelectedValue"
                                                                            Type="Int32" DefaultValue="0" />
                                                                    </WhereParameters>
                                                                </asp:LinqDataSource>
                                                            </ContentTemplate>
                                                        </asp:UpdatePanel>
                                                    </Content>
                                                </ext:Tab>
                                            </Tabs>
                                        </ext:TabPanel>
                                    </ext:FitLayout>
                                </Content>
                            </ext:Panel>
                        </Center>
                    </ext:BorderLayout>
                </Content>
            </ext:ViewPort>
        
    
        </form>
    </body>
    </html>
    I have the simplified rowcommand function that , I think, should just create an invoice window in the existing window but i get this error with some encrypted viewstate data highlighted in the debug screen:

    Microsoft JScript runtime error: 'this.ctl32' is null or not an object
    if i use the same code in a pageload it works fine
        
    protected void Page_Load(object sender, EventArgs e)
        {
            Window win = new Window();
            win.Title = "Invoice";
            win.AutoLoad = "http://localhost:3077/BICSI-Vantage2...istration.aspx";
            this.form1.Controls.Add(win);
        }
    any ideas?
  2. #2

    RE: create window from within another window

    Hi Jason,

    "I think" the problem is because OnRowCommand you're adding the Window to the <form>. With an UpdatePanel, any controls added to the Pages ControlCollection *must* be added to a control inside the UpdatePanel. Adding the Window the form will not thrown an Exception, but the html required to render the Window will not be properly added to the Page because the UpdatePanel does not change/add html outside of the <asp:UpdatePanel>.

    You should be able to work around the problem by placing a <asp:PlaceHolder> control somewhere inside the <asp:UpdatePanel> and then on the RowCommand add the Window to the PlaceHolder.

    Hope this helps.
    Geoffrey McGill
    Founder
  3. #3

    RE: create window from within another window

    Thanks Geoffrey

    I was able to get the new window to open inside the window that fires the code but how do I get the new window to open in the parent window of the window that fires the code?

    Sorry if i'm not being clear...

    I have a main application page (default.aspx) that has an ext:window for customer info that autoloads another page (customer.aspx). In that customer ext:window I have a list of invoices in an ext:tab and wish to setup the invoice numbers as links that will open a new ext:window for invoice info but make that ext:window a child of the main page.

    It seems like a simple thing but I can't figure it out...

    Is this possible?

  4. #4

    RE: create window from within another window

    ok, I think I'm going to have to see some code in order to figure this out. Can you create a simplified sample which demonstrates the scenario, or part(s) of the scenario?

    If you're using the .AutoLoad property and setting with a url that starts with "http", then an <iframe> will be created and the url loaded into it. Under that scenario, the page acts as an island and trigger events outside of the <iframe> gets complicated.
    Geoffrey McGill
    Founder
  5. #5

    RE: create window from within another window

    I made a small sample to help explain what I'm trying to do.

    The customer link in the west accordian will open the customer window.

    In the customer window I placed code to open the invoice window. This fires on page_load now but will need to fire from RowCommand so I left that code in as well.

    Currently invoice opens as a child of customer. I would like for invoice to open as a child of the main viewport page.

    All of the files I use are local so it does not need to use the http:// if that makes it easier to solve I just did not know how to reference the local files...


    Thanks in advance for the help!


    P.S. I had to remove the coolite dll to fit the 512k attachment limit.

Similar Threads

  1. Create window dinamically
    By milenios in forum 2.x Help
    Replies: 3
    Last Post: Aug 14, 2012, 1:59 PM
  2. Replies: 2
    Last Post: Jul 26, 2012, 2:12 AM
  3. Create new window dynamically on button click from another window
    By softlabsgroup.support in forum 1.x Help
    Replies: 6
    Last Post: May 01, 2012, 9:26 AM
  4. How to create a window codebehind?
    By snippher in forum 1.x Help
    Replies: 4
    Last Post: Mar 23, 2009, 8:42 PM
  5. Add JavaScript to Window on create?
    By ajaxus in forum 1.x Help
    Replies: 3
    Last Post: Feb 26, 2009, 11:25 AM

Posting Permissions