Get NavigateURL from javascript

4 posts, 1 answers
  1. Kurt Kluth
    Kurt Kluth avatar
    166 posts
    Member since:
    Oct 2009

    Posted 26 Jul Link to this post

    I am looking to get the URL from the radWindow from javascript.  I would rather not have to set it via javascript but not doing this it won't be able to resize the radwindow as it returns an error.  I would like to get the NavigateURL from the radWindow

    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript" src="/scripts/ValidateFileType.js"></script>
        <script src="/scripts/ModalWindow.js" type="text/javascript"></script>
        <script type="text/javascript">
     
        function openWinNavigateUrl() {
                var oWnd = $find("<%= rwApplication.ClientID%>");
            oWnd.setUrl("/Repository/Application/2_CompletedPDF.pdf");
            sizeRadWindow(oWnd, 50, 55);
            oWnd.show();
        }
     
        function sizeRadWindow(oWnd, width, height) {
            var browserWidth = $telerik.$(window).width();
     
            var browserHeight = $telerik.$(window).height();
            oWnd.setSize(Math.ceil(browserWidth * width / 100), Math.ceil(browserHeight * height / 100));
            oWnd.center();
     
        }
        </script>
    </telerik:RadCodeBlock>

     

                        <telerik:RadLinkButton runat="server" Text="View Completed Application"
                            OnClientClicked="openWinNavigateUrl" AutoPostBack="false" ID="_appLink">
                        </telerik:RadLinkButton>
    <telerik:RadWindow RenderMode="Lightweight" runat="server" ID="rwApplication" NavigateUrl="/Repository/Application/2_CompletedPDF.pdf"
        Modal="true" InitialBehaviors="Maximize" RestrictionZoneID="NavigateUrlZone" AutoSize="false" VisibleStatusbar="false" ShowContentDuringLoad="false"
        Behaviors="Close, Maximize" Title="Completed Application">
    </telerik:RadWindow>
  2. Answer
    Vessy
    Admin
    Vessy avatar
    2022 posts

    Posted 02 Aug Link to this post

    Hi Kurt,

    You can access the URL of a RadWindow object through its get_navigateUrl() method:

    var url = oWnd.get_navigateUrl();

    On the other hand, the faced issue is related to the set initial behaviors of the Window (InitialBehaviors="Maximize") and the fact the size is set before the window is shown. Moving the show() call just above the call of the sizeRadWindow() function and removing the set initial behvaior of the Window (due to which the control needs more time in order to calculate its size) will allow you to resize it without reseting the url:

            <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
                <script type="text/javascript">
                    function openWinNavigateUrl() {
                        var oWnd = $find("<%= rwApplication.ClientID%>");
                        oWnd.show();
    
                        sizeRadWindow(oWnd, 50, 55);
                    }
    
                    function sizeRadWindow(oWnd, width, height) {
                        var browserWidth = $telerik.$(window).width();
                        var browserHeight = $telerik.$(window).height();
                        oWnd.setSize(Math.ceil(browserWidth * width / 100), Math.ceil(browserHeight * height / 100));
                        oWnd.center();
                    }
                </script>
            </telerik:RadCodeBlock>
    
            <telerik:RadLinkButton runat="server" Text="View Completed Application"
                OnClientClicked="openWinNavigateUrl" AutoPostBack="false" ID="_appLink">
            </telerik:RadLinkButton>
            <telerik:RadWindow RenderMode="Lightweight" runat="server" ID="rwApplication" NavigateUrl="/Repository/Application/2_CompletedPDF.pdf"
                Modal="true" RestrictionZoneID="NavigateUrlZone" AutoSize="false" VisibleStatusbar="false" ShowContentDuringLoad="false"
                Behaviors="Close, Maximize" Title="Completed Application">
            </telerik:RadWindow>

     

    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.
  3. Kurt Kluth
    Kurt Kluth avatar
    166 posts
    Member since:
    Oct 2009

    Posted 05 Aug Link to this post

    Thank you Vessy for providing the answer and pointing out a bigger issue and offering a suggestion on how to fix it.  
  4. Vessy
    Admin
    Vessy avatar
    2022 posts

    Posted 07 Aug Link to this post

    Hi,

    You are absolutely welcome, Kurt - I am glad the given suggestion is working for you :) Let us know whenever any further question occurs.

    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.
Back to Top