error opening rad window

4 posts, 1 answers
  1. CBARS
    CBARS avatar
    55 posts
    Member since:
    Sep 2008

    Posted 23 Feb 2009 Link to this post

    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
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 23 Feb 2009 Link to this post

    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.
  3. CBARS
    CBARS avatar
    55 posts
    Member since:
    Sep 2008

    Posted 23 Feb 2009 Link to this post

    Hi, yes it works great, thanks for the quick reply.
  4. Luis
    Luis avatar
    1 posts
    Member since:
    Mar 2017

    Posted 02 Mar Link to this post

    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

Back to Top