Solved

Display Text Without HTML Codes and Keep Formatting

Posted on 2013-06-10
3
849 Views
Last Modified: 2013-06-11
Hello,

I'm using tinyMCE 4.x, ASP.Net & VB - I successfully use the editor to encode text to html format and save it to a database.  Now I retrieve the text, for editing, to the textArea and it displays with the html text instead of diplaying text in format it was input at.  How do I correct this?  

Ex:
The dog jumped over the fence.
The cat swam through the river.

Shows up as: <p>The dog jumped over the fence.<br>The cat swam through the river.</p>

I looked at the TinyMCE API 4.x examples but it's not sinking in.  

Is there something I can do in either TinyMCE or in ASP.net - to have it display as it was originally entered?

Thanks
JS
0
Comment
Question by:jshesek
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 18

Accepted Solution

by:
Matthew Kelly earned 500 total points
ID: 39236540
When you said "encode" text, are you converting "<" to "&lt;" ? If so you would need to decode before putting back into the editor.

tinyMCE has a HTML view. Can you look to see if this is what is shown:

&lt;p&gt;The dog jumped over the fence.&lt;br&gt;The cat swam through the river.&lt;/p&gt;

Open in new window


If so, it is because your HTML is being converted to text and so tinyMCE thinks the < and the > are text instead of html tags.

You can't use HttpServerUtility.HtmlEncode for example because it will ruin TinyMce's content. TinyMce does it's own HTML encoding on client side. If you need to do server side encoding you will need to figure out what isn't html and only encode that (no idea how to go about that).
0
 
LVL 14

Expert Comment

by:dejaanbu
ID: 39236779
you need to comment encoding: 'xml' on your configuration.
0
 
LVL 1

Author Comment

by:jshesek
ID: 39237569
Ok got it to work.  But the formatting looks a little off.  Will investigate this further.

This is what I did:

The form is an edit form - so only 1 record was pulled with a datareader (dr)

TextBox1.Text = Server.HtmlDecode(dr("meetingNotes"))

Thanks for pointing me in the right direction.
0

Featured Post

Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question