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

radmenu error from radwindow that has already closed?

1 Answer 38 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Steven asked on 15 Aug 2012, 03:37 PM
I've got a web page with a script that opens  radwindows for me with an onclose .

       

function openPatientDemoWin(url, title, AddOnClose, OnCloseMethod) {
    var Wnd = radopen(url, 'frank');
    Wnd.set_title(title);
    Wnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Resize);
    Wnd.set_autoSize(true);
    Wnd.set_modal(true);
    Wnd.set_visibleStatusbar(false);
     
    Wnd.set_destroyOnClose(true);
    if (AddOnClose == '1') {
 
        Wnd.add_close(OnCloseMethod);
    }
    return false;
}

 

 

 


The radwindow has a radgrid with a radmenu. 

this is the radmenu in the radgrid, the items are added in the codebehind so I can attach attributes to them

<telerik:RadMenu ID="RadMenu1" runat="server"
OnClientItemClicked="RadMenu1_onClicked"
>
<Items>
<telerik:RadMenuItem ImageUrl="/images/icon_actionmenu.gif" BorderStyle="None" BorderWidth="0px" >
<GroupSettings ExpandDirection="Right" ></GroupSettings>
<Items>
</Items>
</telerik:RadMenuItem>
</Items>
</telerik:RadMenu>






These are the scripts on the radwindow that close and pass back arguments for me
<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 RadMenu1_onClicked(sender, args) {
         var item = args.get_item();
         var MenuItem = item.get_attributes().getAttribute("MenuItem");
         var DueDateID = item.get_attributes().getAttribute("DueDateID");
 
         var oArg = new Object();
         oArg.MenuItem = MenuItem;
         oArg.DueDateID = DueDateID;
         var oWnd = GetRadWindow();
         oWnd.close(oArg);
     }
      
 
 </script>

this is the script on the parent window that handles the onclose method
function Archive_OnClose(oWnd, args) {
    debugger;
    var arg = args.get_argument();
    debugger;
    if (arg) {
        switch (arg.MenuItem) {
            case '17P':
                 
                break;
            case 'RISK':
 
                break;
            case 'PH':
                debugger;
                window.location = '/OB/OBAssessmentsList.aspx?AM=wfe34tgsdge4&ADD=' + arg.DueDateID;
                debugger;
                break;
        }
 
 
 
    }
    debugger;
}

the problem I am having is after the Archive_OnClose finishes I am getting the following error and am not sure how to get rid of it. By the time this error occurs, the radwindow has already closed and the onclose method has already fired so not sure why it is happening. All the debuggers have been hit
this._renderAccessKey();
b.RadMenu._updateChildrenPositionClass(this.get_parent());
b.RadMenu._updateChildrenPositionClass(this);
},get_linkElement:function(){if(!this._linkElement){this._linkElement=$telerik.getFirstChildByTagName(this.get_element(),"a",0);

the error is on the last line and its
Microsoft JScript runtime error: '$telerik' is undefined

1 Answer, 1 is accepted

Sort by
0
Kate
Telerik team
answered on 20 Aug 2012, 08:20 AM
Hi Steven,

The error that you get most probably occurs because some of the controls can not load the scripts needed for the controls to work properly. Please take a look at the following help article where you can find more explanation how to workaround the exception that you get - General Troubleshooting

Greetings,
Kate
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Menu
Asked by
Steven
Top achievements
Rank 1
Answers by
Kate
Telerik team
Share this question
or