Solved

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

Posted on 2011-09-10
1
590 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now