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

Hide toolbar in window.onbeforeprint()

4 Answers 177 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Lenny_shp
Top achievements
Rank 2
Lenny_shp asked on 24 Feb 2009, 02:25 PM
Is there a way to hide the toolbar in the editor from print in window.onbeforeprint() ?
I cannot find any API to do so, thanks for the help.

<table id="txtNewCommentWrapper" cellpadding="0" cellspacing="0" style="table-layout:auto;width:100%;height:100%;">

Tried these but no effects under IE7.

document.getElementById("txtNewCommentWrapper").style.display = "none";
document.getElementById("txtNewCommentWrapper").style.visibility = "hidden";

4 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 27 Feb 2009, 01:13 PM
Hi Lenny_shp,

You can get a reference to the top toolbar of RadEditor using the following code:

var editor = $find("<%=txtNewComment.ClientID%>");
var buttonsHolder = $get(editor.get_id() + "Top");         
buttonsHolder.style.display = "none";

All the best,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Lenny_shp
Top achievements
Rank 2
answered on 03 Apr 2009, 03:36 PM
          var editor = $find("<%#txtNewComment.ClientID%>");  
 
during runtime it's blank.  
 
          var editor = $find("");  
 
                <telerik:RadEditor ID="txtNewComment" runat="server" AutoResizeHeight="True" Skin="Office2007" 
                      BorderStyle="none" BorderWidth="0" ToolbarMode="ShowOnFocus" ToolsWidth="345px" 
                    EditModes="Design" ToolsFile="BasicTools.xml" 
                      Width="720px" Height="100px" TabIndex="21">  
                </telerik:RadEditor> 
0
Tervel
Telerik team
answered on 06 Apr 2009, 01:50 PM
Hello Lenny_shp,

MS AJAX controls (such as RadEditor and all other Telerik RadControls) are created and initialized during page load. Hence it is not possible to dump the code on the page - rather - you need to execute the code where you need it - in your onbeforeprint event handler.

Furthermore, you need to copy and use the code that we provide without introducing changes.
The code sent to you:   $find("<%=txtNewComment.ClientID%>");
The code used by you: $find("<%#txtNewComment.ClientID%>");

Please note the difference - you need to use = instead of #


Best regards,
Tervel
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Lenny_shp
Top achievements
Rank 2
answered on 06 Apr 2009, 05:20 PM
Yes I had your code in the onbeforeprint handler.   If I use = I get this error, and typically the workaround is to change to use # instead.

http://www.telerik.com/community/forums/aspnet/editor/the-controls-collection-cannot-be-modified-because-the-control-contains-code-blocks-i-e-lt-gt.aspx




The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

It's hiding onBeforePrint after I changed it to reference the name directly, and only after I placed focus to allow the toolbar to pop up at least once.    If right after the form loads and Print Preview is used, it still reserves/prints the space for the hidden toolbar.
ToolbarMode="ShowOnFocus"

var editor = $find("txtNewComment");
var buttonsHolder = $get(editor.get_id() + "Top");         
buttonsHolder.style.display = "none";
Tags
Editor
Asked by
Lenny_shp
Top achievements
Rank 2
Answers by
Rumen
Telerik team
Lenny_shp
Top achievements
Rank 2
Tervel
Telerik team
Share this question
or