Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Window > RadWindow open issue

Not answered RadWindow open issue

Feed from this thread
  • GP avatar

    Posted on Feb 9, 2012 (permalink)

    Hi.  I keep getting the following javascript error when I try to open a radwindow: "Uncaught TypeError: Cannot call method 'open' of undefined ".  The document is in a folder, and I am trying to get to it with this url...

    Here is my code:
    <telerik:RadCodeBlock ID="rcb1" runat="server">
        <script type="text/javascript">
     
            function openDoc() {
                var myBox = $find("<%= RadTextBox1.ClientID %>");
                var myURL = myBox.get_value()
     
                window.radopen("Folder1\/" + myURL + ".pdf", "ViewDoc");
                return false;
            }
     
     
        </script>
    </telerik:RadCodeBlock>
               
    and my radWindow:
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true" Skin="WebBlue">
            <Windows>
                <telerik:RadWindow ID="ViewDoc" runat="server" Title="Add or Edit"
                Width="410px" Height="475px" ReloadOnShow="true" ShowContentDuringLoad="false"
                Modal="true" />
            </Windows>
    </telerik:RadWindowManager>


    Any help is greatly appreciated.

    Reply

  • Posted on Feb 9, 2012 (permalink)

    Hello,

    I tried to reproduce the problem but no avail. Make sure that the folder path is given correctly.
    JS:
    function OnClientClick()
     {
      var myBox = $find("<%= RadTextBox1.ClientID %>");
      var myURL = myBox.get_value();
      window.radopen("../Folder/"+myURL+".aspx", "RadWindow1");
     }

    Thanks,
    Princy.

    Reply

  • GP avatar

    Posted on Feb 10, 2012 (permalink)

    Hi, Princy.  I fixed the URL, but I still get that javascript error "Uncaught TypeError: Cannot call method 'open' of undefined " .

    I even changed the URL to try to reopen Default.aspx instead, but it didn't change the error.  I must have a typo somewhere.  

    Thanks.

    function OnClientClick()
    {
        var myBox = $find("<%= RadTextBox1.ClientID %>");
        var myURL = myBox.get_value();
        window.radopen("../PaperlessImages/" + myURL + ".pdf", "UserListDialog");
        return false;
    }

    Reply

  • GP avatar

    Posted on Feb 10, 2012 (permalink)

    Ok, for some reason, the "OnClientClicked" event was firing whenever the btnView (Radbutton) was loaded...not clicked.  We ended up having to add the onclick as an attribute during the pageload event on the server. 

    Private Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        btnView.Attributes.Add("onclick", "openDoc();return false;")
    End Sub

    Reply

  • Marin Bratanov Marin Bratanov admin's avatar

    Posted on Feb 13, 2012 (permalink)

    Hello GP,

    While this may work I suggest you simply attach the OnClientClicked handler to the RadButton properly. Like all other RadControls the handler needs only the name of the JavaScript function it will call, without the parentheses. They would cause it to execute as soon as the line is parsed, which is too early for the controls to work (they need their scripts which are loaded at a later stage). You can see examples how to attach this handler here.


    Regards,
    Marin
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>

    Reply

  • GP avatar

    Posted on Feb 13, 2012 (permalink)

    That would explain why it kept firing whenever the control was loaded.  I took the parentheses out as you suggested, and it did work as it should.  Thank you for your help.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Window > RadWindow open issue
Related resources for "RadWindow open issue"

ASP.NET Window Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial  ]