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

Any way to prevent using formatting?

4 Answers 60 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 08 Feb 2011, 11:26 PM
I just want to use RadEditor as plain textbox without the user able to use ctrl-b to make certain characters bold because I will only be saving the text and not the formatting in the database.

4 Answers, 1 is accepted

Sort by
0
Rumen Jekov
Top achievements
Rank 1
answered on 08 Feb 2011, 11:42 PM
Hi,

This one is easy. Just use the Text property of RadEditor to obtain the content as plain text and store it to your database.

Regards,
Rumen
0
Lenny_shp
Top achievements
Rank 2
answered on 09 Feb 2011, 03:13 PM
Thanks, I am aware of using .text.   However I would like to disable ctrl-b that the user can perform while in the editor to make text bold if that option is available -- disable any user formatting while in the editor.
0
Rumen Jekov
Top achievements
Rank 1
answered on 09 Feb 2011, 10:19 PM
Hi,

Please, try the following code:

<script type="text/javascript">     
    function OnClientCommandExecuting (editor, args)     
    {     
        if (args.get_commandName() == "Bold")     
        {     
            args.set_cancel(true);     
        }     
    }     
</script>     
<telerik:RadEditor      
    ID="RadEditor1"      
    OnClientCommandExecuting="OnClientCommandExecuting"       
    runat="server">     
</telerik:RadEditor>

The solution is based on the code in the following KB article: http://www.telerik.com/support/kb/aspnet-ajax/editor/disabling-the-built-in-shortcuts-of-radeditor.aspx
0
Lenny_shp
Top achievements
Rank 2
answered on 10 Feb 2011, 04:36 PM
    function OnClientCommandExecuting (editor, args)     
    {     
            args.set_cancel(true);     
    }  

Thanks, will give it to try to disable all short cuts.  (bold, underline, italic, everything else)
Tags
Editor
Asked by
Lenny_shp
Top achievements
Rank 2
Answers by
Rumen Jekov
Top achievements
Rank 1
Lenny_shp
Top achievements
Rank 2
Share this question
or