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

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

9 Answers 372 Views
Window
This is a migrated thread and some comments may be shown as answers.
Pinkey
Top achievements
Rank 1
Pinkey asked on 20 Jul 2009, 10:51 AM

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

9 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 20 Jul 2009, 11:22 AM
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.
0
Shinu
Top achievements
Rank 2
answered on 20 Jul 2009, 12:03 PM
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.
0
Pinkey
Top achievements
Rank 1
answered on 20 Jul 2009, 01:32 PM
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
0
Pinkey
Top achievements
Rank 1
answered on 20 Jul 2009, 02:02 PM
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
0
Accepted
Svetlina Anati
Telerik team
answered on 23 Jul 2009, 09:09 AM
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.
0
Pinkey
Top achievements
Rank 1
answered on 24 Jul 2009, 05:30 AM

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

0
Svetlina Anati
Telerik team
answered on 24 Jul 2009, 07:16 AM
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.
0
Rishi
Top achievements
Rank 1
answered on 10 Mar 2010, 08:01 PM
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
0
Svetlina Anati
Telerik team
answered on 15 Mar 2010, 04:27 PM
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.
Tags
Window
Asked by
Pinkey
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Shinu
Top achievements
Rank 2
Pinkey
Top achievements
Rank 1
Rishi
Top achievements
Rank 1
Share this question
or