ASP.NET MVC passing an ID in an ActionLink to the controller

前端 未结 5 1747
故里飘歌
故里飘歌 2020-12-07 20:03

I can\'t see to retrieve an ID I\'m sending in a html.ActionLink in my controller, here is what I\'m trying to do

  • <%= Html.ActionLink(\"Mod
  • 5条回答
    •  刺人心
      刺人心 (楼主)
      2020-12-07 20:13

      The ID will work with @ sign in front also, but we have to add one parameter after that. that is null

      look like:

      @Html.ActionLink("Label Name", "Name_Of_Page_To_Redirect", "Controller", new {@id="Id_Value"}, null)
      

    提交回复
    热议问题