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

get_contentFrame() return 'null'

2 Answers 160 Views
Window
This is a migrated thread and some comments may be shown as answers.
Sébastien
Top achievements
Rank 1
Sébastien asked on 19 Jul 2010, 06:51 PM
I'm trying to have an application open a radWindow and then print the content inside it. For what I saw it looks like I need to acces the frame element of the radWindow to acheive this. My problem is when I use the method get_contentFrame() it always return null. I tought that I might be beacause the radWindow was not loaded so I tried to call the method from a button inside it but still have the return value null.

I have reproduce the problem a small application, so it is not a problem in my main project. Here is the code :
<%@ Page Language="VB" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="RadControlsWebApp4._Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
    <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <%--Needed for JavaScript IntelliSense in VS2010--%>
            <%--For VS2008 replace RadScriptManager with ScriptManager--%>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
    </telerik:RadScriptManager>
    <script type="text/javascript">
        //Put your JavaScript code here.
 
        function btn_onclick() {
            var win = $find("<%= wndPrint.ClientID %>");
            win.set_modal(true);
            win.show();
            var frame = win.get_contentFrame();
            alert(frame);
        }
 
        function Button2_onclick() {
            var win = $find("<%= wndPrint.ClientID %>");
            var frame = win.get_contentFrame();
            alert(frame);
        }
 
    </script>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
  
    <telerik:RadSkinManager ID="RadSkinManager1" Runat="server" Skin="Office2007">
    </telerik:RadSkinManager>
    <div>
          <input id="btn" type="button" value="Print" onclick="return btn_onclick()" />
          <telerik:RadWindow ID="wndPrint" runat="server" Skin="Office2007">
            <ContentTemplate>
                <p> fvejsh ksad ksla gjkfhsdajkg hfskjd ahgkfhdasgkl fd</p><hr />
                <p>fdsi fdsjafkh ajkgfda ghfdkj shgjkfdshg fdkjsg hd</p>
                <input id="Button2" type="button" value="Print" onclick="return Button2_onclick()"/>
            </ContentTemplate>
        </telerik:RadWindow>
    </div>
     
    </form>
    </body>
</html>

Thank you for your time,
Sébastien

2 Answers, 1 is accepted

Sort by
0
Accepted
Svetlina Anati
Telerik team
answered on 20 Jul 2010, 09:01 AM
Hi Sébastien,

I see in your code that you are using the RadWindow with a ContentTemplate - in this mode the controls reside on the very same page as the RadWindow. That is why you do not need an IFRAME element which is used when you load an external page. If you want to use an IFRAME, you should put the content on a separate page and set its url as NavigateUrl for the window - otherwise referencing and manipulating a content frame does not make sense since the content is DIV when ContentTemplate is used.

I hope that my explanations are detailed enough and helpful, let me know if you have additional questions.

All the best,
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
0
Sébastien
Top achievements
Rank 1
answered on 20 Jul 2010, 02:32 PM
Thanks for the answer, I have done what I wanted without the RadWindow finally.
Tags
Window
Asked by
Sébastien
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Sébastien
Top achievements
Rank 1
Share this question
or