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

a.parentnode is null or not an object Jscript runtime error

4 Answers 117 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Alicia Liew
Top achievements
Rank 1
Alicia Liew asked on 07 Oct 2009, 11:32 AM
after changing to RadControl 2009 Q2 dll. i had meet some problem on my page that having RadWindow call back.
it prompting me "Microsoft JScript runtime error: 'parentNode' is null or not an object".

the error from file MicrosoftAjaxWebForms.js
and suspected is from a DIV
<DIV style="Z-INDEX: 10000; POSITION: absolute; FILTER: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=50); BACKGROUND-COLOR: #aaaaaa; WIDTH: 1259px; DISPLAY: none; HEIGHT: 903px; TOP: 0px; LEFT: 0px; opacity: .5; mozOpacity: .5" class=TelerikModalOverlay unselectable="on"></DIV>

the function in this js file was actually try to removeChild.
i unable to trace where is actually the error happen.
can anyone helps?
do let me know if insufficient info i provided.

Thanks a lot...

4 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Tunev
Telerik team
answered on 07 Oct 2009, 01:04 PM
Hi Alicia,

This could happen in complex scenarios where there are many object references in different pages. The easiest way to solve the problem without changing the logic is to use the DestroyOnClose property. Set ti to true and RadWindow's object will be destroyed once it is closed. Please note however that in such case, when you run your code again, you will not be able to open that same RadWindow until the page is reloaded. A new RadWindow with the default settings from the RadWindowManager will be opened instead. That is why in scenario like this, it is better to either set all the neeeded properties in the RadWindowManager or ot set them by using the client-side API every time you open the RadWindow.

I hope this helps. If you still experience problems after that, it will be best to open a support ticket and to send us a sample project where this issue could be reproduced. We will examine it and do our best to help.



All the best,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Alicia Liew
Top achievements
Rank 1
answered on 08 Oct 2009, 02:29 AM
Hi Georgi Tunev,

it's really help, thanks a lot.
after i add DestroyOnClose properties in my RadWindow it currently running fine.
Thanks for your helps.

Best Regards,
Alicia Liew
0
Gajanan
Top achievements
Rank 2
answered on 10 Sep 2010, 11:21 AM
hello,

my problem is, i am using the radgrid in that i am showing the status of each row (it is a hyperlink)
on click of status i am showing the radwindow in that i have option to change the status for that row.
on rad window i have 2 buttons Save and close on on save i am saving the status in database and redirecting to the parent page
while redirecting it should refresh the parent page and update the status of that row.
even on close button i want same ,

but now it is refreshing the page only first time when i open the radwindow and closed it but after i want to change the status of second row i am getting the jscript error "element parent node is null" and "Object doesnot support property or method" after this idid some changes,
i used  DestroyOnClose="true"  then it is showing the
 
my code is below on Parent page
i using the
<telerik:RadAjaxPanel ID="rjxPanel_PurchaseOrder" runat="server"
                    LoadingPanelID="RadAjaxLoadingPanel1" Width="100%" Height="100%" >
<tr>
        <td>
            <div id="RestrictionZone" class="module" style="margin-top: 4px; height: 300px; width: 400px;">
                    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" style="z-index:7001">
                        <Windows>
                            <telerik:RadWindow runat="server" ID="RadWindow1" ReloadOnShow="true"
                                ShowContentDuringLoad="true" Modal="true"
                                Height="560px" Width="620px" NavigateUrl="ManagePurchaseOrder.aspx"
                                Animation="Fade" />
                        </Windows>
                    </telerik:RadWindowManager>
            </div>
        </td>
        </tr>
function ChangeStatus(OrderID)
        {
           var EntityID =document.getElementById("ctl00_ContentPlaceHolder1_HiddenField_EntityID").value;
          // window.showModalDialog('ManageStatusChange.aspx?EntityID=' + EntityID + '&EntityType=PurchaseOrder&EntityKeyID='+OrderID , this, "status:no;help:no;overflow:auto;center:yes;dialogWidth:775px;dialogHeight:675px");
           var PopupWindow=radopen('ManageStatusChange.aspx?EntityID=' + EntityID + '&EntityType=PurchaseOrder&EntityKeyID='+OrderID , "RadWindow1");
           PopupWindow.Center();
        }
function refreshParent(arg)
        {
             //Get reference to RadAjaxManager on page  
            if (radManager == null)       
            var radManager = $find('<%= RadAjaxManager.GetCurrent(this).ClientID %>'); 
            //Fire ajax request (optionally pass an event arg value)
            radManager.ajaxRequest(arg);   
        }
in parentAspx.cs
#region RadAjax CodeBlock
 
        RadAjaxManager rjxManager = RadAjaxManager.GetCurrent(this);
        //Create a new delegate to handle the AjaxRequest event  
        rjxManager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(rjxManagerPurchaseOrder_AjaxRequest);
        rjxManager.AjaxSettings.AddAjaxSetting(rjxManager, rjxPanel_PurchaseOrder);
 
        #endregion
#region Rad Ajax Event
 
    protected void rjxManagerPurchaseOrder_AjaxRequest(object sender, AjaxRequestEventArgs e)
    {
        if (e.Argument == "Rebind")
        {
            Session["currentObject"] = null;
            RadGrid_Orders.Rebind();
        }
    }
 
    #endregion


and another page which will show in radwindow

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">  
 
 function GetRadWindow()
  {
       var oWindow = null;
             
            if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;//IE (and Moz as well)
             
            return oWindow;
   }
 
function closeRadWindow()  
{
 
    GetRadWindow().Close();    
}  
 function CloseAndRebind(args)
 {
      GetRadWindow().Close();
      GetRadWindow().BrowserWindow.refreshParent(args);
 }
 
</script>  
</telerik:RadCodeBlock>

and on close button :-
<asp:Button ID="btnClose_Top" runat="server" Text="Close"            
                        OnClientClick="javascript:closeRadWindow();return false;" />

and on save button

string script = "<script>CloseAndRebind('Rebind')</" + "script>";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "CloseAndRebind", script, false); 


PlZ plz tell the solution
0
Georgi Tunev
Telerik team
answered on 13 Sep 2010, 02:20 PM
Hello Gajanan ,

Try switching the lines in your CloseAndRebind() function:

function CloseAndRebind(args)
 {
      GetRadWindow().BrowserWindow.refreshParent(args);
      GetRadWindow().Close();
 }


i.e. first to call the parent page refreshing function and to close the window after that.
If this doesn't help, please open a support ticket and send a sample project so we can investigate further.


Best wishes,
Georgi Tunev
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
Ajax
Asked by
Alicia Liew
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Alicia Liew
Top achievements
Rank 1
Gajanan
Top achievements
Rank 2
Share this question
or