Solved

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

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
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 …

726 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