This is a migrated thread and some comments may be shown as answers.
How to show content of two rad editors in a radwindow on button click
3 Answers 20 Views
This is a migrated thread and some comments may be shown as answers.
Prashant
Top achievements
Rank 1
Prashant asked on 29 Dec 2011, 02:09 PM
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.

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 29 Dec 2011, 03:02 PM
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.
0
Prashant
Top achievements
Rank 1
answered on 03 Jan 2012, 08:08 AM
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 :(
0
Slav
Telerik team
answered on 03 Jan 2012, 02:49 PM
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
Asked by
Prashant
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Prashant
Top achievements
Rank 1
Slav
Telerik team
Share this question
or