Solved

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

Posted on 2011-09-10
1
598 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] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
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…

718 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