ASP.NET核心中的htmlAttribute在哪里<a>?

时间:2016-09-20 06:45:25

标签: asp.net-core

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:

enter image description here

1 个答案:

答案 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>