Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# HTML String Display

Tags:

c#

asp.net-mvc

I am making an application in MVC3, i am storing a string in database in this format

 <a href='path'>Text</a> Happy

The field is saving properly but i have to display it in web page with hyper link like

Text Happy

but currently it is showing like

 <a href='path'>Text</a> Happy

How can i render this string as HTML on web page?

like image 895
Syed Salman Raza Zaidi Avatar asked Jan 24 '12 06:01

Syed Salman Raza Zaidi


2 Answers

If you're using the Razor template engine:

@Html.Raw(mystring)
like image 125
sblom Avatar answered Sep 21 '22 04:09

sblom


If you are using Razor you can use @Html.Raw() as per Phil Haack's quick reference

like image 43
CCBlackburn Avatar answered Sep 18 '22 04:09

CCBlackburn