Solved

How to show stored SQL html data in a MVC3 Razor View?

Posted on 2011-09-10
1
595 Views
Last Modified: 2012-05-12
Hi!
I have saved data in SQL that is to be shown in an MVC3 Razor view at runtime.  The data is formatted with html tags embedded.  I have the data saved to a Session variable which shows the actualy HTML tags on the screen with the option 4 below.  The options 1,2,3 don't show anything in the div on the screen from the cshtml view.

1.       <%= Html.Display(Session["Stuff"]) %>
2.       <%: Html.Display(Session["Stuff"]) %>
3.       @Html.Encode(Session["Stuff"])
4.       @Session["Stuff"]

Thanks for any help,
Jo
0
Comment
Question by:BothWorldsJo
1 Comment
 

Accepted Solution

by:
BothWorldsJo earned 0 total points
ID: 36517438
  Figured it out -         @Html.Raw(Session["Stuff"].ToString())
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

765 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