在整个表行上使用Html.ActionLink

时间:2018-04-16 10:03:24

标签: asp.net-mvc razor

我桌上的@Html.ActionLink元素中有一个<td>,效果很好

当我将链接移至<tr>时,它无效

这种方法是否允许针对整行?我试图使整个行可单击以运行操作而不是列

我的代码是

@foreach (var member in @Model.Memberships)
{
    <tr>
       ---> TRYING TO RUN THIS HERE -- @Html.ActionLink("Switch", "SwitchMembership", "HomePageSurface", new { membershipNumber = member.MembershipNumber, schemeType = member.SchemeType, memberStatusType = member.MemberStatusType, scheme = member.Scheme, returnUrl = Request.Url.AbsolutePath })
        @if (member.Selected)
        {
            <td class="visible-xs"><span class="user-management-current"><i class="fa fa-check"></i></span></td>
        }
        else
        {
            <td class="visible-xs">@Html.ActionLink("Switch", "SwitchMembership", "HomePageSurface", new { membershipNumber = member.MembershipNumber, schemeType = member.SchemeType, memberStatusType = member.MemberStatusType, scheme = member.Scheme, returnUrl = Request.Url.AbsolutePath }, new { @class = "icon-arrow-right" })</td>
        }
        ...
    </tr>
}

0 个答案:

没有答案