RadButton OnClientClicked Event: Microsoft JScript runtime error: '$telerik' is undefined

5 posts, 1 answers
  1. Casey
    Casey avatar
    299 posts
    Member since:
    Jul 2009

    Posted 06 Dec 2011 Link to this post

    Hello All,

    I get the following error when I click on my RadButton: "Microsoft JScript runtime error: '$telerik' is undefined." Here is how my RadButton is setup:

    <telerik:RadButton ID="rbtnCancel" runat="server" Text="Return to Forms Central" OnClientClicked="btnCloseWin" Font-Names="Arial" Font-Size="Medium" AutoPostBack="false">
    </telerik:RadButton>

    Here are the Javascript functions:
    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 btnCloseWin(sender, eventArgs) {
            var oWindow = GetRadWindow();
            oWindow.Close();
        }


    The following code is where the error is shown: var e=$telerik.isMouseOverElementEx(this.get_element(),i);

    When I continue with debugging the program, the RadWindow is closed, but I'm not sure why I am getting this error at all. I am able to close the RadWindow using the Javascript function just fine from an asp:Button.

    I'd greatly appreciate any insight into why this is happening.

    Thanks!
    Casey
  2. Casey
    Casey avatar
    299 posts
    Member since:
    Jul 2009

    Posted 07 Dec 2011 Link to this post

    I am using IE9 version 9.0.8112.16421. If I turn on compatibility view, I do not get the javascript error.

    Thanks,
    Casey
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Slav
    Admin
    Slav avatar
    1356 posts

    Posted 09 Dec 2011 Link to this post

    Hi Casey,

    I tried to reproduce the described problem, but without success. You can find attached my sample, which I used for testing the issue. Please compare it with your project and check if there are differences in the setup. I have added a short video, demonstrating the behavior on my end.

    Note that I am willing to help, but I will need to reproduce the problem, so that I can suggest a more to the point answer. If you are still having difficulties, please open a support ticket and send us either a modified version of the attached sample so that the issue is reproducible or a simple, runnable project that isolates the problem so that we can examine it locally and provide a working solution. 

    Best wishes,
    Slav
    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
  5. Casey
    Casey avatar
    299 posts
    Member since:
    Jul 2009

    Posted 09 Dec 2011 Link to this post

    Hello Slav,

    I just submitted a support ticket with a modified version of the project you provided.

    Thanks!
    Casey
  6. Casey
    Casey avatar
    299 posts
    Member since:
    Jul 2009

    Posted 12 Dec 2011 Link to this post

    Here is the response I received from Telerik. Hopefully this will help anybody else having the same issue I was having.

    --------------------------------------------------------------------------------
    Hi Casey,

    Thank you very much for the provided sample project! Now I am able to reproduce your problem and I can suggest a working solution. 

    The encountered issue stems from the way IE9 handles (and more specifically - disposes) iframes. The lifecycle under this browser is different and the iframe (which is used for rendering the content of the RadWindow) actually does not dispose properly. We are aware of this behavior and if a viable solution is found it will be incorporated in the RadWindow code.

    For the time being you can use a simple workaround that will not affect the performance and functioanlity of your page:
    function btnCloseWin(sender, eventArgs) {
        var oWindow = GetRadWindow();
        setTimeout(function () {
            oWindow.Close();
        }, 0);
    }

    This issue is encountered only when the property DestroyOnClose of the RadWindow is set totrue. If it is not needed in your scenario, I would suggest removing it.

    Feel free to contact us again if you run into more difficulties.

    Regards,
    Slav 
    the Telerik team

    --------------------------------------------------------------------------------
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017