This is a migrated thread and some comments may be shown as answers.

Control with callbacks inside RadWindow

4 Answers 92 Views
Window
This is a migrated thread and some comments may be shown as answers.
ezequiel
Top achievements
Rank 1
ezequiel asked on 30 Oct 2019, 07:09 PM

Hi,

I have a control (PDFViewer) that make callbacks on save, download, etc.., and i manage this events in server side.

The control in isolation works well, I receive the events on the server. But when I place it inside a RadWindow or a RadSplitter I stop receiving the events on the server.

Any idea what the problem might be? Thanks!

4 Answers, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 04 Nov 2019, 10:03 AM

Hi Ezequiel,

Can you, please, elaborate a bit on the exact scenario in which the described problem occurs? How do you initiate the callbacks? Is the content of the RadWindow/RadSplitter updated via AJAX? If so, can you disable the AJAX and see if the problem persists?

https://www.telerik.com/support/kb/aspnet-ajax/ajaxmanager/details/placeholder-is-not-updated-by-radajaxmanager

 

If this is not the case, please, send me a simplified version of your project where I can reproduce the issue and examine the exact setup leading to it. You can see how to prepare such easily here:

https://www.telerik.com/blogs/isolating-a-problem-in-a-sample-project

Regards,
Vessy
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
ezequiel
Top achievements
Rank 1
answered on 06 Nov 2019, 12:00 AM

Hi, thanks for reply

I'm using the control RadPDF (https://www.radpdf.com/). 

The problem mentioned persists, but they gave me another way to do it without using those events, with a PdfIntegrationProvider.

Now I have another problem, when I pass the parameter OnClientLoad = "initRadPdf (); to the control radPDF, the function is never invoked.
If I put the radPDF out of all telerik controls it works fine.

This is the simplified code. That user control, is within a RadMultiPage with RenderSelectedPageOnly = false.

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Accounts.ascx.cs" Inherits="Accounts" %>
<%@ Register Assembly="RadPdf" Namespace="RadPdf.Web.UI" TagPrefix="radPdf" %>

<telerik:RadPersistenceManagerProxy ID="RadPersistenceManagerProxy1" runat="server">
    <PersistenceSettings>
        <telerik:PersistenceSetting ControlID="grdAccounts" />
    </PersistenceSettings>
</telerik:RadPersistenceManagerProxy>

<telerik:RadCodeBlock runat="server" ID="RadCodeBlock1">   
    <script type="text/javascript">       

        var currentLoadingPanel = null;
        var currentUpdatedControl = null;
        function RequestStart(sender, args) {                      
            currentLoadingPanel = $find("AccountsCtrl1_RadAjaxLoadingPanelAccounts");            
            currentUpdatedControl = "AccountsCtrl1_grdAccounts";
            //show the loading panel over the updated control
            if (currentLoadingPanel != null && currentUpdatedControl!=null)
                currentLoadingPanel.show(currentUpdatedControl);
         }

        function ResponseEnd() {
            console.log('Accounts ResponseEnd');
             //hide the loading panel and clean up the global variables
             if (currentLoadingPanel != null)
                 currentLoadingPanel.hide(currentUpdatedControl);
             currentUpdatedControl = null;
             currentLoadingPanel = null;
         }
    </script>
</telerik:RadCodeBlock>

<telerik:RadAjaxManagerProxy ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="mpAccounts" UpdatePanelHeight="100%" />
                <telerik:AjaxUpdatedControl ControlID="grdBPPAccounts" />
                <telerik:AjaxUpdatedControl ControlID="grdAccounts" />
            </UpdatedControls>
        </telerik:AjaxSetting>

        <telerik:AjaxSetting AjaxControlID="mpAccounts">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="grdBPPAccounts" />
                <telerik:AjaxUpdatedControl ControlID="grdAccounts" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="RadMenu1">
            <UpdatedControls>             
            </UpdatedControls>
        </telerik:AjaxSetting>                
    </AjaxSettings>

</telerik:RadAjaxManagerProxy>


<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanelAccounts" runat="server" Skin="Office2010Blue"
    IsSticky="true" Style="position: absolute; top: 0; left: 0; height: 100%; width: 100%;">
</telerik:RadAjaxLoadingPanel>

<div id="MainDiv" style="width: 100%; height: 100%">

    <telerik:RadSplitter runat="Server" ID="RadSplitter1" Width="100%" BorderSize="0"
        BorderStyle="None" PanesBorderSize="0" Height="50%" Orientation="Horizontal"
        VisibleDuringInit="false" Skin="Office2010Blue" LiveResize="True">

        <telerik:RadPane ID="menuPane" runat="server" BorderWidth="0px" Scrolling="None" Height="26px">
            <telerik:RadMenu ID="RadMenu1" runat="server" Skin="Office2010Blue" Width="100%">
                <Items>
                     <!-- items -->
                </Items>
            </telerik:RadMenu>
        </telerik:RadPane>

        <telerik:RadPane ID="TopPane" runat="server" BorderWidth="0px" Height="50%" Width="100%" Scrolling="X">
            <telerik:RadMultiPage ID="mpAccounts" runat="server" SelectedIndex="0" Height="100%" Width="100%" RenderSelectedPageOnly="True">
                <telerik:RadPageView ID="bpp" runat="server" Width="100%" Height="100%">                    
                        <!-- RadGrid grdAccounts -->                      
                </telerik:RadPageView>

                <telerik:RadPageView ID="accounts" runat="server" Width="100%" Height="100%">
                    <asp:Button ID="btnUnFreezeColumn" runat="server" Text="" OnClick="btnUnFreezeColumn_Click" Height="1" Width="1" CssClass="hiddenElement" />
                    <!-- RadGrid -->
                </telerik:RadPageView>
            </telerik:RadMultiPage>

        </telerik:RadPane>
    </telerik:RadSplitter>   

    <script type="text/javascript">
            var api = null;
            var isDownload = false;

            function initRadPdf() {
                console.log('Init Api RadPDF');
                // Get id
                var id = "<%= PdfWebControlLite1.ClientID%>";
                // Get api instance
                api = new PdfWebControlApi(id);
                
                api.addEventListener(
                    "saved",
                    function (evt) {
                        // We don't want to show this prompt if we initiated a download
                        if (!isDownload) {
                        }
                    }
                );
            }
    </script>  

    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Office2010Blue"
        EnableViewState="False" Overlay="True">
        <Windows>
            <telerik:RadWindow ID="RadPDFWindow" runat="server"
                Skin="Office2010Blue" Style="display: none;" Title="AOA"
                DestroyOnClose="True" Behaviors="Close"
                InitialBehaviors="Maximize"
                Modal="True" VisibleStatusbar="False">
                <ContentTemplate>                 
<button onclick="test();if(api){isDownload=false;api.save();}return false;">Save</button><br />
<asp:Label ID="RadPDFFileUrl" runat="server" Visible="false"></asp:Label>
                            <radPdf:PdfWebControlLite id="PdfWebControlLite1" runat="server"  height="600px" width="100%"                                 
                                OnClientLoad="initRadPdf();" 
                                />
                        
                </ContentTemplate>
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>
</div>


0
ezequiel
Top achievements
Rank 1
answered on 06 Nov 2019, 04:17 PM
Hi, I already found another solution. Instead of using the RadWindows ContentTemplate, create a new asp page and show it with NavigateUrl. Thanks!
0
Vessy
Telerik team
answered on 07 Nov 2019, 12:40 PM

Hi,

Thank you for the update, ezequiel - i am glad you have found a solution that is applicable to your scenario.

Let us know should any further question regarding our controls occur.

Regards,
Vessy
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Window
Asked by
ezequiel
Top achievements
Rank 1
Answers by
Vessy
Telerik team
ezequiel
Top achievements
Rank 1
Share this question
or