Child window does not closes in WebDesktop

1 reply. Last post: April 26, 2011 3:17 AM by Riendy Setiadi
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
Tariq HMember

Hi Intersoft

 

I am using "Intersoft WebUI Studio 2009 R2 for ASP.NET".
I am facing problem in closing the dialog windows.
I have been using WebDesktop and within it I am using a page with the code mentioned below.
Now this page lists the user's emails and the user can view an email by clicking on a link and it will open up in another child window. The child window opens up fine but it does not gets closed.

Also, in case if I make IntegratedToDesktopManager="false" instead of "true", the window closing problem disappears but the color and theme of the window changes from its parent window to the default OS window theme and the buttons within the window stops functioning.

    <telerik:RadScriptBlock runat="Server" ID="RadScriptBlock2">

        <script type="text/javascript" language="javascript">

            var SiteId;
            var Language;
            var NewEmailPage;
            var ViewEmailPage;
            
            window.onload = func1;
            
            function func1() {
                NewEmailPage = document.getElementById("hdNewEmailPage").value
                ViewEmailPage = document.getElementById("hdViewEmailPage").value

                if (NewEmailPage == "") {
                    NewEmailPage = cwc.getWebDesktopURL('NewEmail.aspx');
                    document.getElementById("hdNewEmailPage").value = NewEmailPage;
                }
                if (ViewEmailPage == "") {
                    ViewEmailPage = cwc.getWebDesktopURL('ViewEmail.aspx');
                    document.getElementById("hdViewEmailPage").value = ViewEmailPage;
                }
            }
            
            function RowDblClick(sender, eventArgs) {
                openViewEmail(eventArgs.getDataKeyValue("EmailId"), eventArgs.getDataKeyValue("MessageId"));
            }

            function EmailViewClick(sender, eventArgs) {
                openViewEmail(eventArgs.getDataKeyValue("EmailId"), eventArgs.getDataKeyValue("MessageId"));
            }

            function RowSelected(sender, args) {
            }
            function DelegateHanlder(cmdName, functionData) {
                switch (cmdName) {
                    case "openNewEmail":
                    case "opennewemail":
                        var splitData = functionData.split("#")
                        openNewEmail(splitData[0], splitData[1]);
                        break;
                }
            }

            function ChangeCheckBoxState(id, checkState) {
                var cb = document.getElementById(id);
                if (cb != null)
                    cb.checked = checkState;
            }

            function ChangeAllCheckBoxStates(checkState) {
                // Toggles through all of the checkboxes defined in the CheckBoxIDs array
                // and updates their value to the checkState input parameter
                if (CheckBoxIDs != null) {
                    for (var i = 0; i < CheckBoxIDs.length; i++)
                        ChangeCheckBoxState(CheckBoxIDs[i], checkState);
                }
            }

            function ChangeHeaderAsNeeded() {
                // Whenever a checkbox in the GridView is toggled, we need to
                // check the Header checkbox if ALL of the GridView checkboxes are
                // checked, and uncheck it otherwise
                if (CheckBoxIDs != null) {
                    // check to see if all other checkboxes are checked
                    for (var i = 1; i < CheckBoxIDs.length; i++) {
                        var cb = document.getElementById(CheckBoxIDs[i]);
                        if (!cb.checked) {
                            // Whoops, there is an unchecked checkbox, make sure
                            // that the header checkbox is unchecked
                            ChangeCheckBoxState(CheckBoxIDs[0], false);
                            return;
                        }
                    }

                    // If we reach here, ALL GridView checkboxes are checked
                    ChangeCheckBoxState(CheckBoxIDs[0], true);
                }
            }

            function mnbCommand_MouseUp(id, menuCommand) {
                var mi = menuCommand.SelectedMenuItem;
                if (mi != null) {
                    switch (mi.Name) {
                        case "Exit":
                            ISCloseCurrentWindow();
                            break;
                        case "NewEmail":
                            openNewEmail();
                            break;
                        default:
                            alert(mi.Text + " item clicked.");
                            break;
                    }
                }
            }

            function tblCommand_MouseUp(id, toolCommand) {
                var mi = toolCommand.SelectedMenuItem;
                if (mi == null && toolCommand.Type != "DropDownButton") {
                    switch (toolCommand.Name) {
                        case "NewEmail":
                            openNewEmail();
                            break;
                        case "Download":
                            AjaxArg = "Download"
                            $find("<%= RadAjaxMgr.GetCurrent(Page).ClientID %>").ajaxRequest(AjaxArg);
                            break;
                        case "Delete":
                            var firstDataItem = $find("grdEmails").MasterTableView.get_selectedItems()[0];
                            if (firstDataItem == null) return;
                            var EmailID = firstDataItem.getDataKeyValue("EmailId");
                            var subject = firstDataItem.getDataKeyValue("Subject");
                            AjaxArg = "Delete," + EmailID
                            if (!window.confirm('<%= TranslateText("ConfirmDelete.Text")%>')) break;
                            $find("<%= RadAjaxMgr.GetCurrent(Page).ClientID %>").ajaxRequest(AjaxArg);
                            break;
                        default:
                            alert(toolCommand.Text + " tool command invoked.");
                            break;
                    }
                }
                else if (mi != null) {
                    alert(mi.Text + " menu command invoked.");
                }
            }

            function showDialog(dialogName, dialogUrl) {
                var wnd = ISGetDesktopManager();
                var wdb = ISGetObject(dialogName);
                wdb.SetContentURL(dialogUrl);
                return wdb.ShowDialog();
            }

            function openNewEmail(emailId, action) {
                var newEmailUrl = NewEmailPage + '&Language=' + Language;
                if (emailId != null) {
                    newEmailUrl += '&emailId=' + emailId;
                    var firstDataItem = $find("grdEmails").MasterTableView.get_selectedItems()[0];
                    if (firstDataItem != null) {
                        var messageId = firstDataItem.getDataKeyValue("MessageId");
                    }
                    if (messageId != null) newEmailUrl += '&messageId=' + messageId;
                }
                if (action != null) newEmailUrl += '&action=' + action;
                showDialog("dlgNewEmail", newEmailUrl);
            }

            function openViewEmail(emailId, messageId) {
                var viewEmailUrl = ViewEmailPage + '&winname=wndNewEmail&cmdname=openNewEmail&Language=' + Language + '&emailId=' + emailId + '&messageId=' + messageId;
                showDialog("dlgViewEmail", viewEmailUrl);
            }

            function OnBeforeClosed(controlId, tabItem) {
                return true;
            }           

        </script>

    </telerik:RadScriptBlock>
</head>
<body id="body" runat="server" leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0"
    language="javascript">
    <form id="form1" runat="server">
    <asp:HiddenField ID="hdNewEmailPage" runat="server" Value="" />
    <asp:HiddenField ID="hdViewEmailPage" runat="server" Value="" />
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnableViewState="true"
        EnableHistory="true">
        <Scripts>
            <asp:ScriptReference Path="~/js/cwc.js" />
        </Scripts>
    </telerik:RadScriptManager>
    <telerik:RadAjaxManager runat="server" ID="RadAjaxMgr">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadAjaxMgr">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="grdEmails" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1" />
    <div runat="server" id="_LnTag">
        <div id="Div1" runat="server">
            <table id="PlaceHolderManager1_phm" border="0" cellpadding="0" cellspacing="0" style="width: 100%;
                border-collapse: collapse; height: 100%">
                <tr>
                    <td id="PlaceHolderManager1_phmtda" colspan="3" valign="top">
                        <table id="PlaceHolderManager1_phmtda_phmtblda" border="0" cellpadding="0" cellspacing="0"
                            style="width: 100%; border-collapse: collapse">
                            <tr>
                                <td id="PlaceHolderManager1_phmtda_phmtblda_0" align="left" style="overflow: hidden;
                                    height: 1px" valign="top">
                                    <ISWebDesktop:WebMenuBar ID="mnbCommand" runat="server" DockingArea="Top" PlaceHolder="PlaceHolderManager1"
                                        Width="100%" HandleVisible="No" DisplayMode="Text">
                                        <Menus>
                                            <ISWebDesktop:MenuCommand Name="File" Text="File">
                                                <Items>
                                                    <ISWebDesktop:WebMenuItem Name="NewEmail" Text="NewEmail" ImageURL="~/Images/writemail-16.gif">
                                                    </ISWebDesktop:WebMenuItem>
                                                    <ISWebDesktop:WebMenuItem Name="Separator1" Type="Separator">
                                                    </ISWebDesktop:WebMenuItem>
                                                    <ISWebDesktop:WebMenuItem Name="Exit" Text="Exit">
                                                    </ISWebDesktop:WebMenuItem>
                                                </Items>
                                            </ISWebDesktop:MenuCommand>
                                        </Menus>
                                        <CommandClientSideEvents OnMouseUp="mnbCommand_MouseUp" />
                                    </ISWebDesktop:WebMenuBar>
                                </td>
                            </tr>
                            <tr>
                                <td id="PlaceHolderManager1_phmtda_phmtblda_1" runat="server" align="left" style="overflow: hidden;
                                    height: 1px" valign="top">
                                    <table dir="ltr">
                                        <tr>
                                            <td>
                                                <ISWebDesktop:WebToolBar ID="tlbCommand" runat="server" DockingArea="Top" PlaceHolder="PlaceHolderManager1"
                                                    Width="280px" DisplayMode="Default" Caption="File" FillDockingRow="No" DockingRow="1">
                                                    <Commands>
                                                        <ISWebDesktop:ToolCommand Category="tlbCommand" DisplayMode="TextAndImage" Image="~/Images/writemail-16.gif"
                                                            Name="NewEmail" Text="NewEmail">
                                                        </ISWebDesktop:ToolCommand>
                                                        <ISWebDesktop:ToolCommand Category="tlbCommand" Name="ToolCommand3" Type="Separator">
                                                        </ISWebDesktop:ToolCommand>
                                                        <ISWebDesktop:ToolCommand AutoPostBack="Yes" Category="tlbCommand" DisplayMode="TextAndImage"
                                                            Image="~/Images/download-emails-16.gif" Name="Download" Text="Download" ToolTip="Download">
                                                        </ISWebDesktop:ToolCommand>
                                                        <ISWebDesktop:ToolCommand Category="tlbCommand" Name="ToolCommand3" Type="Separator">
                                                        </ISWebDesktop:ToolCommand>
                                                        <ISWebDesktop:ToolCommand Category="tlbCommand" DisplayMode="TextAndImage" Image="~/Images/delete.gif"
                                                            Name="Delete" Text="Delete" ToolTip="Delete">
                                                        </ISWebDesktop:ToolCommand>
                                                    </Commands>
                                                    <CommandClientSideEvents OnMouseUp="tblCommand_MouseUp" />
                                                </ISWebDesktop:WebToolBar>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr valign="top">
                    <td id="PlaceHolderManager1_phmlda" style="overflow: hidden; width: 1px" valign="top">
                        <table id="PlaceHolderManager1_phmlda_phmtblda" border="0" cellpadding="0" cellspacing="0"
                            style="width: 1px; border-collapse: collapse; height: 100%">
                            <tr>
                                <td id="PlaceHolderManager1_phmlda_phmtblda_0" align="left" style="overflow: hidden;
                                    width: 1px" valign="top">
                                </td>
                                <td id="PlaceHolderManager1_phmlda_phmtblda_1" align="left" style="overflow: hidden;
                                    width: 1px" valign="top">
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td id="PlaceHolderManager1_phmic" valign="top">
                        <table cellspacing="2" cellpadding="2" summary="Pages Design table" width="100%"
                            border="0">
                            <tr>
                                <td align="center">
                                    <asp:Label runat="server" ID="lblMailBoxMessage"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <telerik:RadGrid ID="grdEmails" runat="server" Height="400px" AllowAutomaticDeletes="false"
                                        AutoGenerateColumns="False" AllowMultiRowSelection="false" CssClass="MyRadGrid"
                                        AllowAutomaticUpdates="false" da>
                                        <MasterTableView AllowSorting="False" AllowPaging="false" DataKeyNames="EmailId"
                                            TableLayout="Fixed" ClientDataKeyNames="EmailId,MessageId">
                                            <NoRecordsTemplate>
                                                <asp:Label runat="server" CssClass="AlignCenter" ID="lblNoRecords" ResourceKey="lblNoRecords"
                                                    Width="100%" align="center" />
                                            </NoRecordsTemplate>
                                            <Columns>
                                                <telerik:GridBoundColumn DataField="EmailId" HeaderText="EmailId" Visible="false">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="MessageId" HeaderText="MessageId" Visible="false">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="FromName" HeaderText="From" HeaderStyle-HorizontalAlign="Center"
                                                    ItemStyle-HorizontalAlign="Center">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="ToEmail" HeaderText="To" HeaderStyle-HorizontalAlign="Center"
                                                    ItemStyle-HorizontalAlign="Center">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="Subject" HeaderText="Subject" HeaderStyle-HorizontalAlign="Center"
                                                    ItemStyle-HorizontalAlign="Center">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridTemplateColumn>
                                                    <ItemTemplate>
                                                        <a href='javascript:openViewEmail(<%# Eval("EmailId")%>,"<%# Eval("MessageId")%>");'>
                                                            <%=TranslateText("ViewEmail")%></a>
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>
                                            </Columns>
                                        </MasterTableView>
                                        <ClientSettings EnablePostBackOnRowClick="false">
                                            <Selecting AllowRowSelect="true" />
                                            <Scrolling AllowScroll="true" UseStaticHeaders="True" SaveScrollPosition="True" />
                                        </ClientSettings>
                                        <PagerStyle Mode="NextPrevAndNumeric" />
                                    </telerik:RadGrid>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Literal ID="CheckBoxIDsArray" runat="server"></asp:Literal>
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td id="PlaceHolderManager1_phmrda" style="overflow: hidden; width: 1px" valign="top">
                        <table id="PlaceHolderManager1_phmrda_phmtblda" border="0" cellpadding="0" cellspacing="0"
                            style="width: 1px; border-collapse: collapse; height: 100%">
                            <tr>
                                <td id="PlaceHolderManager1_phmrda_phmtblda_0" align="left" style="overflow: hidden;
                                    width: 1px" valign="top">
                                </td>
                                <td id="PlaceHolderManager1_phmrda_phmtblda_1" align="left" style="overflow: hidden;
                                    width: 1px" valign="top">
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td id="PlaceHolderManager1_phmbda" colspan="3" style="overflow: hidden; height: 1px"
                        valign="top">
                        <table id="PlaceHolderManager1_phmbda_phmtblda" border="0" cellpadding="0" cellspacing="0"
                            style="width: 100%; border-collapse: collapse">
                            <tr>
                                <td id="PlaceHolderManager1_phmbda_phmtblda_0" align="left" style="overflow: hidden;
                                    height: 1px" valign="top">
                                </td>
                            </tr>
                            <tr>
                                <td id="PlaceHolderManager1_phmbda_phmtblda_1" align="left" style="overflow: hidden;
                                    height: 1px" valign="top">
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </div>
        <ISWebDesktop:PlaceHolderManager ID="PlaceHolderManager1" runat="server" IsDefaultPagePlaceHolderManager="True"
            IsDesignInitialize="True" PlaceHolderContainer="Div1" AllowCustomize="No" FillDockingRow="No"
            DisplayMode="Image">
            <DockAreaStyle Overflow="Hidden" OverflowX="Hidden" OverflowY="Hidden">
            </DockAreaStyle>
        </ISWebDesktop:PlaceHolderManager>
    </div>
    <ISWebDesktop:WebDialogBox ID="dlgViewEmail" runat="server" Height="350px" Text="View Message"
        Width="570px" IntegratedToDesktopManager="true">
        <WindowSettings ContentMode="UseIFrame">
            <ContainerStyle Height="100%" Width="100%" />
        </WindowSettings>
    </ISWebDesktop:WebDialogBox>
    <ISWebDesktop:WebDialogBox ID="dlgNewEmail" runat="server" Height="350px" Text="123456789"
        Width="570px" IntegratedToDesktopManager="true" EnableViewState="true">
        <WindowSettings ContentMode="UseIFrame">
            <ContainerStyle Height="100%" Width="100%" />
        </WindowSettings>
    </ISWebDesktop:WebDialogBox>
    </form>


Thanking you in anticipation.

 

Regards
Tariq

All times are GMT -5. The time now is 10:47 PM.
Previous Next