create window from within another window
Coolite Toolkit Version 0.5.4 now available for download.
 

Coolite Forums

Welcome Guest ( Login | Register )
 
create window from within another window
Subscribe
Last Login: Yesterday @ 6:35:20 AM
Posts: 34,
Posted 7/28/2008 8:16:56 PM

Group: Coolite Early Adopter

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">
  <div>
  <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" Showonload="false" Icon="User" Minimizable="true" runat="server" Collapsible="true" Title="Individual" AutoLoad="http://localhost:3077/BICSI-Vantage2/windows/favorites/findindividual.aspx" Width="800" Height="800" CloseAction="Hide">
  </ext:Window>
  </div>
  </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/windows/financials/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>
    <div>
        <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>
    </div>
    </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/windows/events/registration.aspx";
        this.form1.Controls.Add(win);
    }   


any ideas?

Jason Lee Ertle
Last Login: Today @ 2:38:25 AM
Posts: 448,
Posted 7/29/2008 8:51:59 AM

Group: Core Development Team
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
- Experimentalist
twitter [personal] [coolite]
Last Login: Yesterday @ 6:35:20 AM
Posts: 34,
Posted 8/6/2008 6:54:22 AM

Group: Coolite Early Adopter
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?

Jason Lee Ertle
Last Login: Today @ 2:38:25 AM
Posts: 448,
Posted 8/6/2008 7:18:21 AM

Group: Core Development Team
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
- Experimentalist
twitter [personal] [coolite]
Last Login: Yesterday @ 6:35:20 AM
Posts: 34,
Posted 8/7/2008 12:46:41 PM

Group: Coolite Early Adopter
 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.

Jason Lee Ertle
Post Attachments
Window_to_Parent.rar (3 views, 3.80 KB)
« Prev Topic | Next Topic »
Reading This Topic
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.
All times are GMT -8:00, Time now is 6:04am