get_contentFrame() return 'null'

3 posts, 1 answers
  1. Sébastien
    Sébastien avatar
    55 posts
    Member since:
    Jun 2010

    Posted 19 Jul 2010 Link to this post

    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" "">
    <head runat="server">
        <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
        <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
                <%--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" />
        <script type="text/javascript">
            //Put your JavaScript code here.
            function btn_onclick() {
                var win = $find("<%= wndPrint.ClientID %>");
                var frame = win.get_contentFrame();
            function Button2_onclick() {
                var win = $find("<%= wndPrint.ClientID %>");
                var frame = win.get_contentFrame();
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <telerik:RadSkinManager ID="RadSkinManager1" Runat="server" Skin="Office2007">
              <input id="btn" type="button" value="Print" onclick="return btn_onclick()" />
              <telerik:RadWindow ID="wndPrint" runat="server" Skin="Office2007">
                    <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()"/>

    Thank you for your time,
  2. Answer
    Svetlina Anati
    Svetlina Anati avatar
    2795 posts

    Posted 20 Jul 2010 Link to this post

    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,
    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
  3. Sébastien
    Sébastien avatar
    55 posts
    Member since:
    Jun 2010

    Posted 20 Jul 2010 Link to this post

    Thanks for the answer, I have done what I wanted without the RadWindow finally.
Back to Top