How to close windows from a child iFrame button?

  1. #1

    How to close windows from a child iFrame button?

    Hi All,

    I create a window inside CategoryList.aspx and load CategoryAddPage.aspx inside the window.

    Create a Window
    static Window windowsaction;
    protected void cmdCreateWindows_Click(object sender, DirectEventArgs e)
    {
            string url = "CategoryAddPage.aspx?parentid=" + parentid.ToString() + "&level=" + level.ToString();
            windowsaction = null;
            windowsaction = new Window
            {
                ID = "windowsaction",
                Title = "Category Add",
                Height = 500,
                Width = 400,
                Border = false,
                Maximizable = true,
                Minimizable = true,
                IDMode = Ext.Net.IDMode.Explicit,
                ClientIDMode = System.Web.UI.ClientIDMode.Static,
                Collapsible = true,
                Modal = true,
                CloseAction = CloseAction.Destroy,
                Loader = new ComponentLoader
                {
                    Url = url,
                    Mode = LoadMode.Frame,
     
                    LoadMask =
                    {
                        ShowMask = true
                    }
     
                }
            };
            windowsaction.Render(this.Form);
    }
    CategoryAddPage.aspx
    <%@ Page Title="" Language="C#" MasterPageFile="~/ithinkltd/pages/ExtMasterPage.master" AutoEventWireup="true" CodeFile="CategoryAddPage.aspx.cs" Inherits="ithinkltd_pages_CategoryAddPage" %>
     
    <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
        <ext:Viewport ID="Viewport1" runat="server" Layout="FitLayout">
            <Items>
                <ext:FormPanel ID="FormPanel1" runat="server" ButtonAlign="Right" BodyCls="formpanelstyle">
                    <Items>
                        <ext:TextField ID="txtCategoryName" runat="server" AnchorHorizontal="100%" FieldLabel="Category Name" LabelAlign="Top">
                        </ext:TextField>
                        <ext:FileUploadField ID="txtCategoryImage" runat="server" AnchorHorizontal="100%" FieldLabel="Category Image" LabelAlign="Top">
                        </ext:FileUploadField>
                        <ext:TextField ID="txtSEOTitle" runat="server" AnchorHorizontal="100%" FieldLabel="SEO Title" LabelAlign="Top">
                        </ext:TextField>
                        <ext:TextField ID="txtSEOKeyword" runat="server" AnchorHorizontal="100%" FieldLabel="SEO Keyword" LabelAlign="Top">
                        </ext:TextField>
                        <ext:TextField ID="txtSEODescription" runat="server" AnchorHorizontal="100%" FieldLabel="SEO Description" LabelAlign="Top">
                        </ext:TextField>
                    </Items>
                    <Buttons>
                        <ext:Button ID="cmdSaveAndClode" runat="server" Icon="Disk" Text="Save & Close">
                        </ext:Button>
                        <ext:Button ID="cmdClose" runat="server" Icon="Cancel" Text="Close">
                            <DirectEvents>
                                <Click OnEvent="cmdClose_Click"></Click>
                            </DirectEvents>
                        </ext:Button>
                    </Buttons>
                </ext:FormPanel>
            </Items>
        </ext:Viewport>
    </asp:Content>
    Close Button Event
    protected void cmdClose_Click(object sender, DirectEventArgs e)
    {
        // Close Parent Windows Here!
    }
    Is it possible to close windows from code behind?
    Thanks,
    Sang Nguyen
  2. #2
    Hello!

    Yes, the most easy way to do this using X.AddScript()
  3. #3
    Quote Originally Posted by Baidaly View Post
    Hello!

    Yes, the most easy way to do this using X.AddScript()
    It does work.

    X.AddScript("parentAutoLoadControl.close()");
    Please close thread.

    Thanks Baidaly,

    Sang Nguyen

Similar Threads

  1. Replies: 7
    Last Post: Feb 09, 2012, 11:17 AM
  2. Reacting to a tab close from a child page
    By costab in forum 1.x Help
    Replies: 4
    Last Post: May 31, 2011, 11:13 AM
  3. Replies: 1
    Last Post: Dec 07, 2010, 8:30 AM
  4. Replies: 0
    Last Post: Jan 08, 2009, 11:31 AM
  5. HOW DO ON CLICK CLOSE A WINDOWS
    By wkcode in forum 1.x Help
    Replies: 1
    Last Post: Oct 14, 2008, 12:45 PM

Posting Permissions