How to show content of two rad editors in a radwindow on button click

4 posts, 0 answers
  1. Prashant
    Prashant avatar
    5 posts
    Member since:
    Nov 2011

    Posted 29 Dec 2011 Link to this post

    Hi,

    I want to show content of two rad editors (both are on the same page) in a radwindow (on same page) on a button click using javascript.
    Can you please help me in this regard?

    A code sample will be a great help.

    Also when I am showing content of a control in radwinow. It is working fine on first click (showing correct content). When I close the rad window and again click on the same button, it opens the rad window but this time it comes blank. No content is shown in radwindow.


    Can you please help me in this.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 29 Dec 2011 Link to this post

    Hello,

    Try the following by adding one div element inside ContentTemplate of RadWindow.
    ASPX:
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
     <Windows>
        <telerik:RadWindow ID="RadWindow1" runat="server">
           <ContentTemplate>
              <div id="windowContent">
              </div>
           </ContentTemplate>
        </telerik:RadWindow>
     </Windows>
    </telerik:RadWindowManager>
    JS:
    <script type="text/javascript">
     function OnClientClick()
      {
         window.radopen(null, "RadWindow1");
         var RadEditor1 = $find("<%= RadEditor1.ClientID %>");
         var txt = RadEditor1.get_contentArea().innerText;
         document.getElementById("windowContent").innerHTML = txt;
      }
    </script>

    Thanks,
    Princy.
  3. Prashant
    Prashant avatar
    5 posts
    Member since:
    Nov 2011

    Posted 03 Jan 2012 Link to this post

    Hi Princy,

    I have tried the code you provided but no luck. I am not able to get preview for the first click too now :(
  4. Slav
    Admin
    Slav avatar
    1359 posts

    Posted 03 Jan 2012 Link to this post

    Hi Prashant,

    The presented sample will function properly only under Internet Explorer as the other browsers do not support the innerText property. To ensure that the content of the RadEditor is retrieved successfully, please use either the control's client method get_text() to get the content as a plain text or get_html(true) to return the editor content as HTML (If the bool parameter is set to true, the returned HTML content will be modified by the RadEditor client filters).

    Note that the RadWindow control doesn't support setting its content on the client-side. Even if it functions as expected in the example, there are cases in which the content will not be persisted due to moving the RadWindow in the DOM. Please prepare and send a sample, fully runnable page, which isolates your scenario, so that we can examine it locally and suggest a concrete solution.

    Greetings,
    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
Back to Top