Sadegh
Sadegh

Reputation: 4341

How to stop encoding strings in ASP.NET MVC 3 beta 1?

How to stop encoding strings in ASP.NET MVC 3 beta 1?

Upvotes: 3

Views: 1731

Answers (1)

house9
house9

Reputation: 20604

I assume you mean HTML encoding?

in the comments of this post, it says you can use the helper method Html.Raw

http://weblogs.asp.net/scottgu/archive/2010/12/16/asp-net-mvc-3-implicit-and-explicit-code-nuggets-with-razor.aspx

example from that post (Razor views, guessing same for other view engines?)

@{
    string content = "<b>Hello World</b>";
}

This is some html: @Html.Raw(content)

another good post about Raw method

http://davidhayden.com/blog/dave/archive/2010/12/27/HtmlRawRazorViewEngine.aspx

Upvotes: 6

Related Questions