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

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

7 Answers 701 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Raka
Top achievements
Rank 1
Raka asked on 08 Jun 2016, 02:03 PM

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>

7 Answers, 1 is accepted

Sort by
1
Vessy
Telerik team
answered on 08 Jun 2016, 02:45 PM
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.
0
Raka
Top achievements
Rank 1
answered on 08 Jun 2016, 03:26 PM

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);

0
Raka
Top achievements
Rank 1
answered on 08 Jun 2016, 07:30 PM

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');



0
Vessy
Telerik team
answered on 13 Jun 2016, 12:28 PM
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.
0
Majda
Top achievements
Rank 1
answered on 30 May 2018, 10:25 AM

Hi

Can anyone help how to use url while open pdf file radopen

Java Script

function openPdf_1(sender, args) {
var radwindow1 = radopen("http://192.168.2.157/AD, K-107 11.06.2013, DDR# 10.pdf", null);
radwindow1.SetTitle("Test");
radwindow1.set_width("500");
radwindow1.set_height("500");
radwindow1.center();
}

It give error file or Directory 404 I had given Everyone Read and write permission

thank you

0
IT Invoices
Top achievements
Rank 1
answered on 28 Aug 2020, 09:42 PM
radscriptmanager was outside form tag. after putting it within the form tags this error went away for me
0
Vessy
Telerik team
answered on 31 Aug 2020, 04:57 PM

Hi Madja,

Can you try the suggestions form the following article and see what the result will be?

https://docs.telerik.com/devtools/aspnet-ajax/general-information/troubleshooting/web-resources-troubleshooting#dealing-with-the-404-error-code-the-requested-url-was-not-found

Please, make sure as well that you have given all permissions to the Telerik handlers as well:
https://docs.telerik.com/devtools/aspnet-ajax/general-information/troubleshooting/web-resources-troubleshooting#unauthorized-access-401-error

<configuration>
  ...
  <location path="Telerik.Web.UI.WebResource.axd">
    <system.web>
      <authorization>
    <allow users="*"/>
      </authorization>
    </system.web>
  </location>
  <location path="Telerik.Web.UI.DialogHandler.aspx">
    <system.web>
      <authorization>
    <allow users="*"/>
      </authorization>
    </system.web>
  </location>
  <location path="ScriptResource.axd">
    <system.web>
      <authorization>
    <allow users="*"/>
      </authorization>
    </system.web>
  </location>
  <location path="WebResource.axd">
    <system.web>
      <authorization>
    <allow users="*"/>
      </authorization>
    </system.web>
  </location>
  ...
</configuration>

 

Regards,
Vessy
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
General Discussions
Asked by
Raka
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Raka
Top achievements
Rank 1
Majda
Top achievements
Rank 1
IT Invoices
Top achievements
Rank 1
Share this question
or