I would like to insert htmlAttribute
to the following code
<a asp-action="MyTestAction" asp-controller="Home" asp-route-myid1="a" asp-route-myid2="b">Test</a>
as there is at @Html.ActionLink
:
答案 0 :(得分:2)
您正在使用代码帮助程序。
使用标记帮助程序,您可以将属性作为原始HTML属性直接插入到视图正文中:
<a asp-action="MyTestAction"
asp-controller="Home"
asp-route-myid1="a"
asp-route-myid2="b"
class="foo"
disabled
data-whatever="@razor_expression">Test</a>