Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Window > writing into radwindow in javascript
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

writing into radwindow in javascript

Feed from this thread
  • Posted on Jul 13, 2006 (permalink)

    It's possible writing an html page into a radwindows popup in similar way as into standard popup. For example:

    _window.document.write('<html><title></title><body>Test</body></html>');

    _window.document.close();
    NB: The html page is not a static page but loaded from db

    Thanks Dev Team

  • Georgi Tunev Georgi Tunev admin's avatar

    Posted on Jul 14, 2006 (permalink)

    Hello Andrea,

    Here is how to do this by using the OnClientPageLoad() method:

    <script> 
    function OnClientPageLoad()   
            {  var oManager = GetRadWindowManager();   
     
                var oWnd = oManager.GetWindowByName("Radwindow1");   
                oWnd.GetContentFrame().contentWindow.document.write('<html><title></title><body>Test</body></html>');  
                oWnd.Show();  
            }  
    </script> 
        <radw:radwindowmanager id="Singleton" runat="server">  
            <windows> 
                <radw:radwindow   
                NavigateUrl = "test.aspx" 
                OnClientPageLoad="OnClientPageLoad" modal="true" height="230px" visibleonpageload="true" 
                    id="Radwindow1"></radw:radwindow> 
            </windows> 
        </radw:radwindowmanager> 


    I hope this helps.

    Regards,
    Georgi Tunev
    the telerik team

  • Posted on Jul 14, 2006 (permalink)

    It works correctly.
    Thanks for help
    TrentaGradi Dev Team

  • Posted on Jul 26, 2006 (permalink)

    Hello there is a little problem, if I want to open a new window and write html code for more than one times that code will be append to the previous code writed in the windows precedently. How can I clear the content of the window ?

    _window.GetContentFrame().contentWindow.document.clear dont work.

    Thx for answer

    Best regards Dev Trentagradi 

  • Tervel Tervel admin's avatar

    Posted on Jul 27, 2006 (permalink)

    Hello Andrea,

    Technically, your question is not related to r.a.d.window.
    You would face the same problem if you want to "clear" the contents in a regular IFRAME.

    Here is what MSDN says on the matter:

    "clear Method
    Not currently supported. To clear all elements in the current document, use document.write(""), followed by document.close."

    We strongly suggest if you encounter further problems down the road to first make sure that your code works with IFRAMEs, before trying it on r.a.d.window objects.

    Sincerely yours,
    Tervel
    the telerik team

  • The Oracle avatar

    Posted on Jun 26, 2008 (permalink)

    Hey Team--

    How do I do this in r.a.d.Window ASP.NET AJAX?

    I'm trying ...

    function ShowAlert(embedHTML)  
    {  
        var alertWindow = GetAlertWindow();  
        if (alertWindow)   
        {  
            if (embedHTML)  
            {  
               debugger;  
               var htmlString = "<html><body style='font-family:Verdana; color:Red;'>" + embedHTML + "</body></html>";  
               alertWindow.get_contentFrame().contentWindow.document.write(htmlString);  
            }  
            alertWindow.Show();  
        }  
    //else {alert( 'no window!');}  
     
    }  
     

    ...but it doesn't work.  I get the message "alertWindow.GetContentFrame().contentWindow' is null or not an object"

    Thanks again for your immense help.

    Graeme

  • Georgi Tunev Georgi Tunev admin's avatar

    Posted on Jun 27, 2008 (permalink)

    Hi Graeme,

    Here is the code for the ASP.NET AJAX version of the control:
    function OnClientPageLoad()    
    {  var oManager = GetRadWindowManager();    
     
        var oWnd = oManager.GetWindowByName("Radwindow1");    
        oWnd.get_contentFrame().contentWindow.document.write('<html><title></title><body>Test</body></html>');   
        oWnd.Show();   
    }   


    Kind regards,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

  • The Oracle avatar

    Posted on Jun 27, 2008 (permalink)

    Dear Georgi,

    Thank you so much for your assistance.  I just couldn't figure that out!

    It turns out the ASP.NET AJAX version of r.a.d.Window has expanded (or I didn't perceive the capacity in the Classic version), to include the ability to send forth HTML to the radAlert window.  This also works well, and is a coding time-saver:

     
    function ShowAlert(embedHTML)  
    {  
        var htmlString = "<span style='font-family:Verdana; color:Red;'>" + embedHTML + "</span>";  
        radalert(htmlString, nullnull'Important Message');  
    }  
     
     

    Thanks again for a superior set of controls!

    Graeme

  • Georgi Tunev Georgi Tunev admin's avatar

    Posted on Jun 27, 2008 (permalink)

    Hi Graeme,

    Thank you for the nice words - we really appreciate it.

    Indeed both RadWindow for ASP.NET and ASP.NET AJAX have this feature. I will make sure that this is more obvious in the demos for the next update of the RadWindow control.



    Kind regards,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

  • Bader Master avatar

    Posted on May 2, 2011 (permalink)

    Hello,

    I have a problem,
    I have a radwindow control which displays a webpage that contains a label control.
    I need to set the height of this radwindow in that label and use it within the c# code of the page.

    i'm using rhe following javascript code:
    function FocusOnRadWindow() {
                window.setTimeout(function () {
                    GetRadWindow().GetContentFrame().contentWindow.focus();
                    var wndHeightValue = GetRadWindow().get_popupElement().style.height.toString().replace("px", "");
                    document.getElementById("TestLabel").innerHTML = wndHeightValue;
                }, 100);
            }

    I call the above function like this:
    <body onload="FocusOnRadWindow()">

    The height is retrieved without problems, but the issue is I can't access that value in code behind. for example, If I use the following code, I recieve an error message (Attached):
    int wndHeight = Convert.ToInt32(TestLabel.Text) - 130;

    Please, Can you explain to me how can I solve this problem.
    It is very apprecited to send me the modified code with an explaination regarding the above situation.

    Regards,
    Bader
    Attached files

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Window > writing into radwindow in javascript