Link to home
Start Free TrialLog in
Avatar of fusioninternet
fusioninternet

asked on

HTML from database changed into text

Hi Experts,

I having trouble displaying some HTML on a page which is being read from an SQL database.

I've followed the introduction to MVC 3 here http://www.asp.net/mvc/tutorials/getting-started-with-mvc3-part1-cs which uses EFCodeFirst for the data connection. All is fine and now I'm using TinyMCE to format the text being saved. Which is also wokring fine as when I look into teh database the text is formatted in HTML.

My problem occurs when I display the desired field on another page. Instead of the text displaying formatted HTML, i get the text  HTML code dispalyed instead.

eg. <strong>Hello World</strong> is displayed as <strong>Hello World</strong> instead of bold "Hello World"

When looking at the source code it read back as:-
&lt;strong&gt;Hello World&lt;/strong&gt;

I'm displaying the field as simple as possible using just <%: Model.main_text %>

Any help on how to get this to display is greatly appreciated.

Steve
ASKER CERTIFIED SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
check the character encoding used by your SQL it should be a charset that can be displayed by your browser.
Avatar of fusioninternet
fusioninternet

ASKER

That did the trick.

Thanks very much.