我创建了这个扩展方法,它以超链接的形式返回数据库中所有类别的字符串。伟大的!
@Html.MyMenu()
问题是链接显示为文本,而不是呈现为超链接。
查看源代码时,我看到:
<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>
我想我可能错了,但我记得在 MVC2(使用默认视图引擎)中你有:
<%: this is rendered, right? %>
还是我弄错了?无论如何,我正在使用 MVC3 和 Razor 引擎。非常感谢你们的帮助。我真的很享受尽可能多地学习这方面的知识。