Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-09-10
1
Medium Priority
?
601 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
[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
1 Comment
 

Accepted Solution

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

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

609 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