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

HTML Formatting Lost

6 Answers 106 Views
Editor
This is a migrated thread and some comments may be shown as answers.
BALA MUKUND
Top achievements
Rank 1
BALA MUKUND asked on 23 Mar 2010, 01:37 AM
Hello,

I am using the RAD Editor to post articles. We would like the HTML formatting to be retained. But when we save it to the database the HTML tags are converted to blocks

e.g. <BR /> is converted to [BR/] which causes the formatting to be completely lost.

Can anyone please assist?

Thanks
Bala

6 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 23 Mar 2010, 10:38 AM
Hi Bala,

Please check the demo link below.You need to pass the Content property value of the RadEditor instead of the Text property
http://demos.telerik.com/aspnet-ajax/editor/examples/saveindatabase/defaultcs.aspx

Shinu

0
BALA MUKUND
Top achievements
Rank 1
answered on 23 Mar 2010, 02:28 PM
Thanks for your response - how can I accomplish the same from the client side (using javascript)?

Thanks
Bala
0
Dobromir
Telerik team
answered on 25 Mar 2010, 05:52 PM
Hi Bala,

I am not quite sure that I understand your scenario. By default, RadEditor has two properties:
  • Text - returns the content of the RadEditor without the HTML tags
  • Content - returns the full content of the RadEditor with the HTML
Could you please provide more detailed information on the subject? How do you implement that HTML tag conversion?

If you want to avoid using CodeBehind you can check the following help article:
Codeless Save In Database ASP.Net 2.0

You can also get the editor's content on the client using the get_html(true) method.

Greetings,
Dobromir
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
BALA MUKUND
Top achievements
Rank 1
answered on 29 Mar 2010, 03:00 PM
Thanks guys. I was able to resolve the issue using the get_html function.

Thanks once again.
Bala
0
Virendra Shinde
Top achievements
Rank 1
answered on 05 Apr 2010, 10:50 PM
Hello,

I have the same issue but I would like the save the spacing, newlines, tabs when I use radeditor.text. is there any Way.

Thanks
-Virendra
0
Rumen
Telerik team
answered on 06 Apr 2010, 09:42 AM
Hello Virendra,

Formatting can be stripped automatically on page submit using the OnClientSubmit event and FormatStripper command of RadEditor. Here is how to strip all formatting except the new lines, e.g.

<script type="text/javascript">
function OnClientSubmit(editor)
{
     editor.fire("FormatStripper", {value : "ALL_NO_BRAKES"});
}
</script>
<telerik:RadEditor runat="server" OnClientSubmit="OnClientSubmit"/>

After that you should obtain the editor's content on the server through the Content property (not the Text one).


Greetings,
Rumen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Editor
Asked by
BALA MUKUND
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
BALA MUKUND
Top achievements
Rank 1
Dobromir
Telerik team
Virendra Shinde
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or