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

How to get the RadEditor to not add any HTML tags to the content being saved?

1 Answer 338 Views
Editor
This is a migrated thread and some comments may be shown as answers.
gs1711
Top achievements
Rank 1
gs1711 asked on 19 Jan 2011, 07:45 AM
I am using RadEditor as textbox and don't want any html tag to be added when Editor's content is saved. I set the attribute
StripFormattingOptions="All"
in the editor. It's not working. I still see the content being saved in my Table in the DB as
"TestContent<BR>"
I want the content to be saved as plain text like "TestContent" and not with the break tags and p tags.
What is the solution to this? Please help. Thanks.

My Editor is as follows:-
<telerik:RadEditor ID="Editor1" EditModes="Design" DialogsCssFile="~/Skins/Default/DialogCSS.css" SpellCheckSettings-AjaxUrl="~/Telerik.Web.UI.SpellCheckHandler.axd" Font-Bold="false" ToolsWidth="360px" Content='<%#Eval("Content") %>' TabIndex="18" Height="30px" Width="100%" BorderWidth="0px" ContentFilters="ConvertCharactersToEntities" runat="server" StripFormattingOptions="All" ToolbarMode="ShowOnFocus" ToolsFile="~/Skins/BasicTools.xml" Language="en-GB" SpellCheckProvider="EditDistanceProvider" SpellEditDistance="2" OnClientSelectionChange="OnClientSelectionChange">
 
<CssFiles> <telerik:EditorCssFile Value="~/css/EditorAsTextBox.css" /> </CssFiles>
<
Tools>
<
telerik:EditorToolGroup>
<telerik:EditorToolName="AjaxSpellCheck"Text="AjaxSpellCheck"/>                                                       </telerik:EditorToolGroup>
</
Tools>
<
Content></Content>
</
telerik:RadEditor>

I added the following script on my page and set RadEditor's attribute OnClientSubmit="OnClientSubmit"..
didn't work..


<script type="text/javascript">
function OnClientSubmit(editor)
editor.fire("FormatStripper", { value: "All" });</script>

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 19 Jan 2011, 08:57 AM
Hello gs1711,

The <br> tag is added by Firefox. To strip it you should enable the ConvertToXhtml filter. IE will also wrap the content in <p> tags. To remove the <p> tags enable the FixEnclosingP filter, e.g.

ContentFilters="ConvertCharactersToEntitie,ConvertToXhtml,FixEnclosingP"

All the best,
Rumen
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Editor
Asked by
gs1711
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or