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

JS Error with RadWindow and custom print button

1 Answer 40 Views
This is a migrated thread and some comments may be shown as answers.
Edward Sudit
Top achievements
Rank 1
Edward Sudit asked on 23 Jun 2010, 07:52 PM
I am using the code posted on this forum for adding a custom print button to the RadWindow title bar.  The code seems to work, but I get an error on the page that seems to be related to issuing the "insertBefore" command.  The code is provided in this post below. 

The error message is:

    Message: Sys.ArgumentUndefinedException: Value cannot be undefined.
    Parameter name: handler
    Line: 2472
    Char: 16
    Code: 0

<telerik:RadScriptBlock runat="server" ID="RadScriptBlock1">
    <script type="text/javascript">
        var radWnd;
        function <%=ClientID%>_OpenPrintWindow(url){
            radWnd = radopen(url, null);
            radWnd.set_title('Print Contract Form');
            radWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move +
                                 Telerik.Web.UI.WindowBehaviors.Close +
        function OnClientShow()
            var TitleBar = radWnd.GetTitlebar();
            var parent = TitleBar.parentNode;
            var oUL = parent.getElementsByTagName('UL')[0];
            if (!( == "customprintbuttonID")) // Check if the element is already added
                // If not - create and add the custom button
       = "192px";
                var oLI = document.createElement("LI");
       = "customprintbuttonID"
                var aPrintBtn = document.createElement("A");
                aPrintBtn.className = "customprintbutton";
                aPrintBtn.href = "javascript:void(0)";
                aPrintBtn.title = "Print Content";
                aPrintBtn.onmousedown = printWin;
                oUL.insertBefore(oLI, oUL.firstChild);

        function printWin(e)
            var content = radWnd.GetContentFrame().contentWindow;
            var printDocument = content.document;
            if (document.all)
            //Cancel event!
            if (!e) e = window.event;

            return $telerik.cancelRawEvent(e);

1 Answer, 1 is accepted

Sort by
Georgi Tunev
Telerik team
answered on 28 Jun 2010, 02:33 PM
Hi Edward Sudit,

I already answered your other forum thread on the same subject. For convenience I am pasting my reply below. If needed, please, let's continue the discussion in the other thread.

The code that you posted is OK and is not raising such error on our side. I believe that the problem might be somewhere else on the page, but without having a better view over your case, I cannot tell for sure.

Please open a support ticket and send me a small sample project where the problem could be reproduced - I will check it right away and do my best to help you.

All the best,
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
Asked by
Edward Sudit
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Share this question