Solved

Display Text Without HTML Codes and Keep Formatting

Posted on 2013-06-10
3
782 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
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jquery progress bar 3 40
ck editor is taking too much time to be loaded in asp 1 17
VB.Net Tranfer data between to VB.Net apps 8 25
List<PaisEntity> - show some 1 24
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
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…

786 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