Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Display Text Without HTML Codes and Keep Formatting

Posted on 2013-06-10
3
Medium Priority
?
1,030 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
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 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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

705 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