Microsoft JScript runtime error: 'undefined' is null or not an object

10 posts, 1 answers
  1. Pinkey
    Pinkey avatar
    17 posts
    Member since:
    Jun 2009

    Posted 20 Jul 2009 Link to this post

    Hi,
        I have to open a rad window on click of image button. But when I click on image button I get the error as
    "Microsoft JScript runtime error: 'undefined' is null or not an object". I am not sure why I am getting this error.
    I have declared the RadWindow as follows:

    <telerik:RadWindow ID="TreatmentDetail" runat="server" Height="412px" Left="10px" ShowContentDuringLoad="false" 
          Modal="true" ReloadOnShow="True" Title="Edit Protocols"  Width="800px" NavigateUrl=""  
          SkinsPath="~/RadControls/Window/Skins" Top="10px" VisibleStatusbar="False" Behavior="None">    
    </telerik:RadWindow> 

    On image button Click:
    Protected Sub imgAddNewTreat_Click(ByVal sender As ObjectByVal e As System.Web.UI.ImageClickEventArgs) Handles imgAddNewTreat.Click  
                Try 
                    Dim NewTreatID As Integer = CType(Session("NewTreatID"), Integer)  
                    Session("TreatWindowTitle") = "Add New Treatment" 
                    Session("TreatmentMode") = "Add" 
                    Session("NewTreatID") = NewTreatID - 1  
                    Session("TreatId") = NewTreatID  
                    Dim scriptstring As String = "ShowEditForm('" & NewTreatID & "' , 'Add' );" 
                    ScriptManager.RegisterStartupScript(MeMe.GetType"TreatmentWindow", scriptstring, True)  
                Catch ex As Exception  
     
                End Try 
    End Sub 

    My Script for getting RadWindow is as follows:
     function ShowEditForm(id, Mode) {  
     
                window.radopen("EditTreatmentProtocol.aspx?Id=" + id + "&Mode=" + Mode, "TreatmentDetail");  
                return false;  
            }  
     

    Please help me regarding this.
    Its very urgent.

    From
    Pinkey
  2. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 20 Jul 2009 Link to this post

    Hello Pinkey,

    I am not completely sure whether you use RadWindow for ASP.NET or RadWindow for ASP.NET AJAX because you have noted that you are using the ajax version of the control and at the same time I see the SkinsPath property in your markup and this property is present only for RadWindow for ASP.NET.

    In case you are using RadWindow for ASP.NET  AJAX, please note that the ajax client objects, including the RadWindowManager are created at last on the page. This means that in the current setup you are calling radopen before the manager is created and that is why you get an error. If this is the case, you should use the Sys.Application.add_load syntax as explained below:

    http://www.telerik.com/support/kb/aspnet-ajax/window/calling-radalert-from-codebehind.aspx


    Kind regards,
    Svetlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 20 Jul 2009 Link to this post

    Hi Pinkey,

    You can also try another approach by setting the properties from server side and show the window from server instead of calling client-side function.

    C#:
     
    Protected Sub ImageButton1_Click(ByVal sender As ObjectByVal e As ImageClickEventArgs)     
        Try 
             . . . 
            Session("TreatWindowTitle") = "Add New Treatment" 
            Session("TreatmentMode") = "Add" 
            Session("NewTreatID") = NewTreatID - 1 
            Session("TreatId") = NewTreatID 
     
            TreatmentDetail.NavigateUrl = "Default.aspx?id=" & NewTreatID & "&Mode=Add" 
            TreatmentDetail.VisibleOnPageLoad = True 
     
        Catch ex As Exception 
        End Try 
    End Sub 
    Checkout the following link to know more about showing RadWindow from server.
    Setting Server-Side Properties

    -Shinu.
  4. Pinkey
    Pinkey avatar
    17 posts
    Member since:
    Jun 2009

    Posted 20 Jul 2009 Link to this post

    Hi,
        I am using RadWindow for ASP.NET AJAX and SkinPath was by mistake added which I removed. But still I am unable to open the RadWindow. I have checked the example given for RadWindow for ASP.NET AJAX and did the same but nothing has helped me.
        Is there any other way I can resolve this error.
    Its stopping my whole development work.

    Thanks,
    Pinkey
  5. Pinkey
    Pinkey avatar
    17 posts
    Member since:
    Jun 2009

    Posted 20 Jul 2009 Link to this post

    Hi Shinu,
               Thanks for replying. But even this has not resolved my issue.
    After using the code provided by you I am not getting the error message but still I am unable to open RadWindow.

    Thanks
    Pinkey
  6. Answer
    Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 23 Jul 2009 Link to this post

    Hello Pinkey,

    I prepared a sample demo for you which shows how to pass two parameters in the url as you wanted and opens the RadWindow from the code behind. The demo uses the Sys.Application.add_load syntax as I already suggested you to use and as explained in the article.

    The demo I prepared for you is for demonstration purposes, feel free to modify it further in order to meet your particular requirements. I hope this is helpful, let us know how it goes.

    Regards,
    Svetlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  7. Pinkey
    Pinkey avatar
    17 posts
    Member since:
    Jun 2009

    Posted 24 Jul 2009 Link to this post

    Hello Svetlina,
                  Thanks a lot for sending me this demo. With the help of this I redesigned the page and now I am able to work without any

    issues regarding this.

                  

    Thanks,

    Pinkey

  8. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 24 Jul 2009 Link to this post

    Hello Pinkey,

    I am glad I could help you in your implementation. In case you encounter any further problems, do not hesitate to contact us again!

    All the best,
    Svetlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  9. Rishi
    Rishi avatar
    43 posts
    Member since:
    Feb 2010

    Posted 10 Mar 2010 Link to this post

    HI

    I ran into the exact same problem. Since I used the ASP .net Ajax, i followed the steps you asked me to follow and got it solved.
    But what i really want to do is have it show up as a modal window and customize the look and feel of the window that is opened, and have  a session variable set with the options that are selected in the window and use them in my parent window after the child window is closed.
    Now how do I know that the child window is closed?? and from where to resume the functionality from my parent window
  10. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 15 Mar 2010 Link to this post

    Hello Rishi,

    The RadWindow provides a handler for the close event - you can use either OnClientClose or OnClientBeforeClose depending on your preferences. You can also attach/remove the handlers on the client by using the syntax add_handlerName and remove_handlerName. More about the events is availlable here:

    http://www.telerik.com/help/aspnet-ajax/window_programmingclientsideevents.html

    Regards,
    Svetlina
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top