RadWindow not opening on button click once closed

3 posts, 0 answers
  1. Jinisha
    Jinisha avatar
    33 posts
    Member since:
    Oct 2012

    Posted 05 Jul 2013 Link to this post

    I have a Gridview that that has some radbuttons. One of them allows the user to fill the pdf document and another Radbutton displays the pdf besides GridView. Once I fill the pdf document and click on view pdf button the pdf opens fine besides the gridview. However, the problem is if I click Close button in the RadWindow. Click on Fill to fill the document and click on view pdf Radbutton again to open the pdf it does not open. I am not sure why. Please advise!

    I have tried using

    string script = "<script language='javascript'>function f(){ShowPDFDocument('" + title + "', '" + url + "');Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>";

             
    but that didn't help.

    Here is some code from my application.  
    <telerik:RadAjaxPanel runat="server" LoadingPanelID="LoadingPanel1">
    <telerik:RadPageView runat="server" ID="tpDocuments">
                        <asp:Panel ID="pnlDocuments" CssClass="Clear" runat="server">
    <div id="divDocuments">
    <asp:GridView>
    <asp:TemplateField ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Left" HeaderStyle-BorderColor="#2F4F4F"
    ItemStyle-BorderColor="#2F4F4F" ItemStyle-VerticalAlign="Top">
    <ItemTemplate>
    <telerik:RadButton ID="rdFill" CssClass="AddMargin" CommandArgument="" CommandName="cnFill"
    runat="server" CausesValidation="False" Icon-PrimaryIconUrl="~/images/fill.gif"
    Skin="Vista" Text="Fill" ToolTip="Fill document" />
    </ItemTemplate>
    </asp:TemplateField>
     
    <asp:TemplateField HeaderStyle-BorderColor="#2F4F4F" ItemStyle-Width="5%" ItemStyle-BorderColor="#2F4F4F"
     HeaderText="View <br/>Doc" ItemStyle-VerticalAlign="Middle" ItemStyle-HorizontalAlign="Left">
     <ItemTemplate>
    <telerik:RadButton ID="imgViewImage" runat="server" Width="16px" Height="16px" OnClick="imgViewImage_Click"
     ToolTip="View Document">
     <Image ImageUrl="~/images/preview.gif" IsBackgroundImage="false" />
     </telerik:RadButton>
     </ItemTemplate>
     </asp:TemplateField>
    </div>
    <div id="divDisplayPDFDocument" class="divDisplayPDFDocument">
    </div>

     

     

     

    </telerik:RadAjaxPanel>
      <telerik:RadWindow runat="server" ID="PDFDocument" OffsetElementID="divDisplayPDFDocument" Modal="false" Behaviors="Close" VisibleStatusbar="false" VisibleTitlebar="True"
          ReloadOnShow="true" RestrictionZoneID="divDisplayPDFDocument" InitialBehaviors="Close">
      </telerik:RadWindow>

     

    <telerik:RadWindow runat="server" ID="PDFWindow" Modal="true" Behaviors="Close, Resize"
        VisibleStatusbar="false" VisibleTitlebar="True" InitialBehaviors="Close, Resize"
        ShowContentDuringLoad="true" VisibleOnPageLoad="false" ReloadOnShow="true" Overlay="true"
        OnClientBeforeClose="PDFWindowBeforeClose" Width="800px" Height="600px">
    </telerik:RadWindow>


    Server side code

     

     

    string title = System.IO.Path.GetFileNameWithoutExtension(tmpDir);
    string url = "ViewFilingPreview.aspx?length=" + doc.Filesize + "&ext=" + System.IO.Path.GetExtension(tmpDir).Replace(".", "") + "&file=" + System.IO.Path.GetFileNameWithoutExtension(tmpDir);
    string script = "ShowPDFDocument('" + title + "', '" + url + "');";
    ScriptManager.RegisterStartupScript(this, GetType(), "ShowPDF", script, true);

     

    Client Side code

     

    function ShowPDFDocument(title, url) {
    var oWnd = $find("<%= PDFDocument.ClientID %>");
    oWnd.set_title(title);
    oWnd.setUrl(url);
    SetPDFSize(oWnd);
    // oWnd.set_restrictionZoneID("divDisplayPDFDocument");
    // oWnd.argument = title;
    // oWnd.remove_pageLoad(windowLoad);
    // oWnd.add_pageLoad(windowLoad);
     oWnd.show();
    }

     

     

     

     

     

     

     

     

     

     


     


     

     

     

  2. Jinisha
    Jinisha avatar
    33 posts
    Member since:
    Oct 2012

    Posted 05 Jul 2013 Link to this post

    BTW, my code works fine in Firefox and Chrome. This happens in IE only. This issue occurs when using Telerik.Web.UI version 2013.1.417.3.5 with my application using .Net Framework 3.5. I have tried using Telerik.Web.UI version 2013.1.417.40 with my application using .Net framework 4.0. Same issue.

    NOTE: When I use older version 2012.2.815.35 with my application using .Net Framework 3.5 it works fine.

    Please advise!
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jinisha
    Jinisha avatar
    33 posts
    Member since:
    Oct 2012

    Posted 05 Jul 2013 Link to this post

    I commented the following line 

      //oWnd.set_restrictionZoneID("divDisplayPDFDocument");

    and added the following lines

    var offsetElementBounds = $telerik.getBounds($get("divDisplayPDFDocument"));
    oWnd.moveTo(offsetElementBounds.x, offsetElementBounds.y);

    in the javascript function given below and now it works in IE too. Please let me know if there is a better way of doing this.

    function ShowPDFDocument(title, url) {
                    var oWnd = $find("<%= PDFDocument.ClientID %>");
                    oWnd.set_title(title);
                    oWnd.setUrl(url);
                    SetPDFSize(oWnd);
                    //oWnd.set_restrictionZoneID("divDisplayPDFDocument");
                    var offsetElementBounds = $telerik.getBounds($get("divDisplayPDFDocument"));
                    oWnd.moveTo(offsetElementBounds.x, offsetElementBounds.y);
                    oWnd.argument = title;                       
                    oWnd.show();
                    return;                
                }
Back to Top