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

Preview in radeditor

6 Answers 230 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Ayesha
Top achievements
Rank 1
Ayesha asked on 21 Aug 2009, 03:15 AM
Hi,

I've a radeditor ctrl and user enters the contents there in it. I've  a "Preview" button which when clciked should popup a different window with the radeditor and its contents (just a preview)  to the user. I've the radeditor in .ascx file. I need to popup another window .
Pls help me with code.

6 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 21 Aug 2009, 07:00 AM
Hello Zaheka,

I implemented a scenario as yours. Let me explain it with code:
aspx(UserControl page):
<telerik:RadEditor ID="RadEditor1" runat="server"
</telerik:RadEditor> 
 
<asp:Button ID="Button1" runat="server" Text="Preview" OnClientClick="openRadWindow();return false;"  /> 
 
<telerik:RadWindowManager ID="WindowManager1" DestroyOnClose="true" runat="server" OnClientShow="ClientShow"
</telerik:RadWindowManager> 

aspx(Child window page - Default1.aspx):
<telerik:radeditor id="RadEditor" runat="server"></telerik:radeditor> 

On clicking the Preview button in the UserControl, you can open the window to another page, which contains another RadEditor. Also on the client show event of the RadWindowManager you can access the parent editor content and assign an argument for the child window:
js(UserControl page):
function openRadWindow() 
   var oWnd = radopen("Default1.aspx""RadWindow1" ); 
   oWnd.Center();   
    
 
function ClientShow(sender, eventArgs) 
    var parentEditor = $find('<%=RadEditor1.ClientID%>'); 
    sender.argument = parentEditor.get_html(); 

Then on the child window page, you can access the current window object and then set the child editor's content to that of the argument passed:
js(Child window page - Default1.aspx):
function pageLoad() 
 { 
   var childEditor = $find('<%=RadEditor.ClientID%>'); 
   var currentWindow = GetRadWindow(); 
   childEditor.set_text(currentWindow.argument); 
 }        
           
function GetRadWindow() 
 { 
    var oWindow = null
    if (window.radWindow) 
       oWindow = window.radWindow; 
    else if (window.frameElement.radWindow) 
       oWindow = window.frameElement.radWindow; 
    return oWindow; 
 }   

Thanks
Princy.
0
Ayesha
Top achievements
Rank 1
answered on 10 Sep 2009, 07:50 PM
Hi Princy,

Thanks for ur reply.

When user enters text in the original radeditor  in ascx , he'll also insert some std tags like <&name> ,<&age> ,<&studid>.
But when he clicks preview btn , a new window opens up with the radeditor and it's contents pasted.

But the std tags need to be replaced with original value.

this is always going to a standard name and age and id(will never change irrespective of user).

Like I've <&name> = John
             <&age> =25
             <&studid> =09

So, how do i replace the tags in the radeditor with these original values in the new popped up window(on click of preview .

pls explain with code.

Thanks,
ZR
0
Vera Jesus
Top achievements
Rank 1
answered on 28 Dec 2009, 03:33 PM
Hi, 

I've a RadTree with a list of Contents that I had created With radEditor. In the MouseOver Event of each node of my radTree I show a RadEditor in the preview mode with the selected content.
But I'm having a problem I would to view the content with a specif size, for example 300*200. For that I'm giving to the radEditor Control the size I want, but the content does not take that size and is appearing over the limits. Is there any way to the radEditor Content size becames the radEditor Size without execeed the margins?

Thanks,

Vera Jesus
0
Rumen
Telerik team
answered on 28 Dec 2009, 03:45 PM
Hi Vera,

Could you please open a support ticket and send a sample working project that demonstrates the problem along with a screenshot demonstrating it?
To open a support ticket you should be a customer or has an active trial license.

Kind regards,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Vera Jesus
Top achievements
Rank 1
answered on 28 Dec 2009, 03:59 PM
I've  already oppened a support ticket with a screenshot of what is happening.  

Thanks,

Vera Jesus

0
Rumen
Telerik team
answered on 29 Dec 2009, 08:32 AM
Hi Vera,

Could you please set the AutoResizeHeight property to true and test the editor, e.g.

<telerik:RadEditor ID="RadEditor1" Runat="server" EditModes="Preview"
    ToolsFile="~/NoTools.xml" Width="100%" Height="200px" AutoResizeHeight="true">
    <Content>
        asd <br/>asdasdasasasd <br/>asdasdasasasd <br/>asdasdasasasd <br/>asdasdasasasd <br/>asdasdasasasd <br/>asdasdasasasd <br/>asdasdasasasd <br/>asdasdasasasd <br/>asdasdasasasd <br/>asdasdasasasd <br/>asdasdasasasd <br/>asdasdasasasd <br/>asdasdasasasd <br/>asdasdasasasd <br/>asdasdasasasd <br/>asdasdasasasd <br/>asdasdasasasd <br/>asdasdasasasd <br/>asdasdasasasd <br/>asdasdasas
    </Content>
</telerik:RadEditor>

Please, note that the Height property value should be set to at least 200px. You can download a sample project from here.

Kind regards,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Editor
Asked by
Ayesha
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Ayesha
Top achievements
Rank 1
Vera Jesus
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or