I have this extension method I created and it returns a string of all the categories in my database as hyperlinks. Great!
@Html.MyMenu()
The problem is that the links are being displayed as text and not rendered as hyperlinks.
When viewing the source code I see:
<div id="menucontainer">
<a href="/Anuncio/Electronics">Electronics</a><a href="/Anuncio/Clothes">Clothes</a><a href="/Anuncio/Domestic">Domestic</a><a href="/Anuncio/Garden">Garden</a>
</div>
I think I may be wrong but I remember that in MVC2 (using the default view engine) you had:
<%: this is rendered, right? %>
Or am I mistaken? Anyways, I'm using MVC3 and the Razor engine. Thanks a lot for your help guys. I'm really enjoying learning as much as I can about this.
Razor escapes HTML by default.
To avoid that, please do something like this: