ActionLink Includes Current {id} in URL

后端 未结 2 1553
醉梦人生
醉梦人生 2021-01-13 16:06

The page currently displayed in my browser is: http://localhost:19255/Object/Browse/1.

A link on this page is created with: @Html.ActionLink(\"...

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-13 16:21

    While neither of the following work:

    @Html.ActionLink("...", "Browse", "Object", null)              // Has no effect
    @Html.ActionLink("...", "Browse", "Object", new { id = null }) // Error
    

    The following solves the issue:

    @Html.ActionLink("...", "Browse", "Object", new { id = "" })   // No ID is passed
    

提交回复
热议问题