我正在使用Razor视图在asp.net MVC 3应用程序中工作。
我有字符串,我需要在其中添加链接:
var closingMsg = "Thank you for submitting your dispute. If you wish, you may <a href='<%= Url.Action('Index', 'Product') %>purchase our SMS alert service</a> for immediate notification of any creditor response or request.";
但它给出了错误。
请使用href或HTML.actionLink建议如何操作。我也需要应用样式链接。
答案 0 :(得分:1)
Razor使用@
而不是<% %>
所以就像这样
<a href='@Url.Action('Index', 'Product')...
这是非常基础的,建议您参加一些初学者教程,以熟悉基础知识。