window.radopen is not working -unable to get property 'open' of undefined or null reference

5 posts, 0 answers
  1. Raka
    Raka avatar
    71 posts
    Member since:
    Sep 2011

    Posted 08 Jun Link to this post

    Hello -- I am not having any luck with opening a popup.  My code is listed below. 

    Can someone please help?  I get an error - 'Unable to get property "open" of undefined or null reference

    Thanks, Raka.

     

    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function editInfo() {
                if (confirm('Are you sure you want to do this?'))
                    return window.radopen('/Folder/Edit.aspx', 'rwGeneric');
        }
        </script>
    </telerik:RadCodeBlock>

  2. Vessy
    Admin
    Vessy avatar
    1388 posts

    Posted 08 Jun Link to this post

    Hi Raka,

    I tested the provided code but the window gets opened proeprly on my side. Please note, that the radopen function requires the RadWindowManager to exist on the page, even though you do not explicitly reference it in your code. Can you verify that you have RadWindowManager declared?

    The code I used for my test is:
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager>
     
    <telerik:RadButton ID="RadButton1" runat="server" Text="Show Window" AutoPostBack="false" OnClientClicked="editInfo"></telerik:RadButton>
     
    <script>
        function editInfo() {
            if (confirm('Are you sure you want to do this?'))
                return window.radopen('/Folder/Edit.aspx', 'rwGeneric');
        }
    </script>


    Regards,
    Vessy
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Raka
    Raka avatar
    71 posts
    Member since:
    Sep 2011

    Posted 08 Jun in reply to Vessy Link to this post

    Oh sorry, I forgot one important piece of information.  It does work with button click.  But I need to call it from server code using RegisterStartupScript.  I have tried the following three methods.  Each opens the window but the popup disappears as soon as it opens.

     

    Thanks

                        string radalertscript = "<script language='javascript'>function f(){radalert('Welcome to RadWindow for <strong>ASP.NET AJAX</strong>!', 330, 210); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>";
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "radalert", radalertscript);
                        
                        //string script = "<script language='javascript'>function f(){radalert('Welcome to RadWindow for <strong>ASP.NET AJAX</strong>!', 330, 210); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>";
                        //Page.ClientScript.RegisterStartupScript(this.GetType(), "radalert", script);
                        
                        ////string script = "function f(){editClassification(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
                        ////ScriptManager.RegisterStartupScript(this, GetType(), "key", script, true);

  5. Raka
    Raka avatar
    71 posts
    Member since:
    Sep 2011

    Posted 08 Jun in reply to Raka Link to this post

    Hello

    I have modified code to execute JS on btn_Click.  Please see below.

    But if I return 'false' from JS, it shows the popup as disabled and the wheel on front goes round and round as if it is trying to load something and never finishes.  So I cannot access the popup window.

    If I return 'true' or return nothing from JS, then the popup shows and disappears quickly after loading.

    Please help.

    Thanks, Raka

     

    Event --

        <asp:Button ID="btnSave" runat="server" Text="Save" OnClientClick="editInfo();" OnClick="btnSave_Click"  ValidationGroup="ValidationSummary1" />

     

    JS --

                function editInfo() {
                    if (confirm('Are you sure you want to do this?')) {
                        window.radopen('/Folder/EditPopup.aspx?ParentControlId=<%= ClientID %>_SelectedInfoString', 'rwGeneric');



  6. Vessy
    Admin
    Vessy avatar
    1388 posts

    Posted 13 Jun Link to this post

    Hi Raka,

    RadWindow's object is created entirely on the Client, this is why it is not persisted after a PostBack is made on the page (the sample from your latest post).

    Please, examine the following article demonstrating the whole configuration needed to call RadWindow (or its dialogs) from the server side and let me know the results:
    http://www.telerik.com/support/kb/aspnet-ajax/window/details/calling-radalert-from-codebehind-%28all-versions-of-radwindow%29

    Regards,
    Vessy
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017