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

Rad Editor with no tools

4 Answers 151 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Rameshkumar
Top achievements
Rank 1
Rameshkumar asked on 05 Apr 2013, 09:08 AM
Hi,

Can the following functionality be achieved without using xml file

http://www.telerik.com/community/forums/aspnet-ajax/editor/how-to-programatically-create-radeditor-with-no-menus.aspx#1408928

Thanks,
Ramesh

4 Answers, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 06 Apr 2013, 09:04 PM
Hi,

You can hide the toolbar using the following css class:

<style>
.reToolCell
{
display: none;
}
</style>

There is also a hack to hide the toolbar which can be used to set the ToolProviderID property with the ID of the control as a value:

<telerik:RadEditor ID="RadEditor1" ToolProviderID="RadEditor1" runat="server" />

Best regards,
Rumen
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.
0
Jeremy
Top achievements
Rank 1
answered on 23 Jun 2014, 12:26 AM
Neither of these worked for me.  The css style had no effect and the "hack" throws a runtime error every time.
Unhandled exception at line 8362, column 1 in http://localhost:64752/ScriptResource.axd?d=SIX1nT3k5ctYiH_Z5iBDXflUZclmLFsht0l-AoEB_WM01ENTjE4sdjqP24yOHX3SrFinD_-liAc_wguOqYOkGyk9EIpmEl5nenKUh5Ryx4tgc3OYCLkTTUbS410Ou3PB376atse5UvbMmC1ENNyNaA2&t=ffffffffab07a9210x800a01b6 - Microsoft JScript runtime error: Object doesn't support property or method 'set_additionalQueryString'
0
Ianko
Telerik team
answered on 23 Jun 2014, 06:17 AM
Hello Jeremy,

You can try one more option to add a RadEditor with no tools. Basically set an empty ToolsFile.xml file to the ToolsFile property.

ASP.NET
<telerik:RadEditor runat="server" ID="RadEditor1" ToolsFile="ToolsFile.xml"></telerik:RadEditor>

ToolsFile.xml
<?xml version="1.0" encoding="utf-8" ?>
<root>
</root>


Regards,
Ianko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Patrick
Top achievements
Rank 1
answered on 05 Jul 2014, 01:07 PM
here is how I handled creating an editor with no toolbar and without the annoying padding above the content sections where the toolbars would go

warning the solution is codebehind visual basic (sorry)

The function below is a helper I made, when a rad editor control is on the page you can call this function to set some easily to configure properties and it's very self explanitory (alter it to fit your needs)

note: css_rad.css is just the basic styling I use for the editor, see it below

body {
    color:#606060;
    font-family:courier new;
    font-size:9pt;
    padding:4px;
}

----------------------------------------------------------------
note there is a lot dimmed and some comments
if there is no toolbar I inherit the class "customtelerik" - this is what makes the blank space where the toolbar would appear go away

this is it's definition, just put in a css file you are inheriting

.customtelerik .reToolCell, .reLeftVerticalSide, .reRightVerticalSide
 {
  display:none !important;
 }


    ''' <summary>
    ''' step1 in setting up the editor
    ''' </summary>
    ''' <param name="rad">the radeditor object passed byREF</param>
    ''' <param name="width">display width in pixels</param>
    ''' <param name="height">display width in pixels</param>
    ''' <param name="css">the name of the stylesheet (if not in the project root then specifiy the path from the root ~/[root])</param>
    Public Sub step1(ByRef rad As Telerik.Web.UI.RadEditor, ByVal width As Integer, ByVal height As Integer, ByVal showtoolbar As Boolean, ByVal showhtmledit As Boolean, Optional ByVal css As String = "~/css_rad.css")
rad.Tools.Clear()
        rad.CssFiles.Add("~/css_rad.css")
        rad.NewLineMode = Telerik.Web.UI.EditorNewLineModes.Br
        If height > 0 Then rad.Height = System.Web.UI.WebControls.Unit.Pixel(height)
        If width > 0 Then rad.Width = System.Web.UI.WebControls.Unit.Pixel(width)
        rad.Modules.Clear()
        rad.BorderWidth = 0
        rad.Skin = "Metro"
        ' will not show HTML, PREVIEW, etc...
        rad.EditModes = EditModes.Design
        rad.Style.Add("max-width", width & "px") ' so you can't resize the editor left to right

        Dim TBmain As New Telerik.Web.UI.EditorToolGroup()
        TBmain.Tools.Clear()
        rad.Tools.Add(TBmain)

        rad.EditModes = EditModes.Design
        If showhtmledit Then
            rad.EditModes = EditModes.Design Or EditModes.Html
        End If

       If showtoolbar = False Then
            rad.CssClass = "customtelerik"
        Else
            'RadEditorStatistics   RadEditorDomInspector   RadEditorNodeInspector   RadEditorHtmlInspector
            Dim stats As New Telerik.Web.UI.EditorModule
            stats.Name = "RadEditorStatistics"
            Dim dom As New Telerik.Web.UI.EditorModule
            dom.Name = "RadEditorDomInspector"
            Dim node As New Telerik.Web.UI.EditorModule
            node.Name = "RadEditorNodeInspector"
            Dim html As New Telerik.Web.UI.EditorModule
            html.Name = "RadEditorHtmlInspector"

            rad.Modules.Clear()
            'rad.Modules.Add(stats)
            'rad.Modules.Add(dom)
            'rad.Modules.Add(node)
            'Rad1.Modules.Add(html)
            addRadTool(TBmain, "Undo")
            addRadTool(TBmain, "Bold")
            addRadTool(TBmain, "Italic")
            addRadTool(TBmain, "Underline")
            addRadTool(TBmain, "StrikeThrough")
            addRadTool(TBmain, "ForeColor")
            addRadTool(TBmain, "BackColor")
            addRadTool(TBmain, "InsertTable")
            addRadTool(TBmain, "AjaxSpellCheck")
            addRadTool(TBmain, "ToggleScreenMode")
            addRadTool(TBmain, "FormatStripper")
            addRadTool(TBmain, "InsertImage")
            addRadTool(TBmain, "InsertLink")
            addRadTool(TBmain, "Unlink")
            addRadTool(TBmain, "LinkManager")
            addRadTool(TBmain, "InsertFormElement")
            addRadTool(TBmain, "InsertExternalVideo")
            addRadTool(TBmain, "JustifyLeft")
            addRadTool(TBmain, "JustifyCenter")
            addRadTool(TBmain, "JustifyRight")
            addRadTool(TBmain, "InsertUnorderedList")
            addRadTool(TBmain, "InsertOrderedList")
         End If

End Sub
Tags
Editor
Asked by
Rameshkumar
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Jeremy
Top achievements
Rank 1
Ianko
Telerik team
Patrick
Top achievements
Rank 1
Share this question
or