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

error opening rad window

3 Answers 276 Views
Window
This is a migrated thread and some comments may be shown as answers.
CBARS
Top achievements
Rank 2
CBARS asked on 23 Feb 2009, 09:02 AM
Hi,

Im getting this error, "Microsoft JScript runtime error: 'undefined' is null or not an object", when trying to open a rad window using the radopen function , it seems as if the radWindowManager cannot be found, because in the following function _1d is undefined after it has passed the second line, this function is created automatically.

window.radopen=

function(url,_1c){

 

var

 

_1d=GetRadWindowManager();

 

return

 

_1d.open(url,_1c);

 

};


i need to open the window after the code behind is executed, this is the code im using to open the window.

aspx page:

<

 

telerik:RadWindowManager ID="RadWindowManager1" runat="server"

 

 

Behavior="Default" InitialBehavior="None" Left="" style="display: none;" Top="">

 

 

<Windows>

 

 

 

<telerik:RadWindow ID="radwUploadFiles" runat="server"

 

 

NavigateUrl="~/Bursaries/UploadConfig.aspx" Title="Upload File(s)"

 

 

VisibleStatusbar="false" Width="840px" Height="620px" ReloadOnShow="true" Skin="Web20">

 

 

</telerik:RadWindow>

 

 

 

</Windows>

 

 

</telerik:RadWindowManager>

 

 

<script type="text/javascript">

 

 

function ShowUploader()

 

{

 

window.radopen(

null, "radwUploadFiles"); 

 

}


code behind(in the image button click event):

ImageButton

 

imgbtn = sender as ImageButton;

 

imgbtn.Attributes.Add(

"OnLoad", "ShowUploader();return false;");

 


any help would be appreciated, thanks.
Regards

3 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 23 Feb 2009, 11:37 AM
Hi,

I guess you want to open RadWindow from the click event of image button. You can try the code snippet below for achieving this (by using RegsterStartupScript). Try this and see whether it suits your need.

CS:
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)  
{  
    ImageButton imgbtn = sender as ImageButton;  
    string script = "<script language='javascript' type='text/javascript'>Sys.Application.add_load(ShowUploader);</script>";  
    ClientScript.RegisterStartupScript(this.GetType(), "ShowUploader", script);  

Thanks,
Princy.
0
CBARS
Top achievements
Rank 2
answered on 23 Feb 2009, 12:08 PM
Hi, yes it works great, thanks for the quick reply.
0
Luis
Top achievements
Rank 1
answered on 02 Mar 2017, 11:28 PM

Hi, when I use this JS

GetRadWindowManager().open(null, "Modal");

I get the error:

JavaScript runtime error: Unable to get property 'open' of undefined or null reference

The radwindow "Modal" has a NavigateURL asigned via CodeBehind

cadena = "../loader.aspx?anio=" + cboYear.SelectedItem.Value + "&mes=" + cboMes.SelectedItem.Value
rwmModal.Windows(0).NavigateUrl = cadena

I am using this code to register the script

If (Not ClientScript.IsStartupScriptRegistered("muestra")) Then
    Page.ClientScript.RegisterStartupScript(Me.GetType(), "muestra", script, True)
End If

 

If I try to use window.radopen() I get the same error, and if it is posible, how can I close the RadWindow from JS?

I'm using Telerik 2016.2 with VS2013

Tags
Window
Asked by
CBARS
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
CBARS
Top achievements
Rank 2
Luis
Top achievements
Rank 1
Share this question
or