MVC my url is creating “?Length=4”

后端 未结 2 1113
温柔的废话
温柔的废话 2021-02-15 13:53

I am creating an MVC4 application. I have a small issue. My code is

  • @Html.ActionLink(\"Contract\", \"Contract\", \"Home\", new {
  • 相关标签:
    2条回答
    • 2021-02-15 14:09

      You mixed up the parameters. You have to send anonymous object as htmlAttributes parameter.

      @Html.ActionLink("Contract", "Contract", "Home", null ,new { id = "lnk_contract" })
      

      Here's the MSDN page for this overload:

      http://msdn.microsoft.com/en-us/library/dd504972(v=vs.108).aspx

      0 讨论(0)
    • 2021-02-15 14:23

      You need to add the parameter

      , new {}
      

      to Html.ActionLink.

      The first object is for the query string, the second is for the HTML parameters.

      0 讨论(0)
    提交回复
    热议问题