开发者

Passing a guid by actionlink

开发者 https://www.devze.com 2023-03-17 19:06 出处:网络
I have an(nothing fancy) for editing a different model by a Guid. I made a ActionResult \"Edit\" with a param (Guid Bedrnr), Still another Edit (int id) is available.

I have an (nothing fancy) for editing a different model by a Guid. I made a ActionResult "Edit" with a param (Guid Bedrnr), Still another Edit (int id) is available. When I call this ActionResult I get an error message about

ambiguous between the following action methods: System.Web.Mvc.ActionResult Edit(Int32) on type D开发者_如何学编程aisyMatchMaker.Controllers.BedrijfsGegevensController System.Web.Mvc.ActionResult Edit(System.Guid) on type DaisyMatchMaker.Controllers.BedrijfsGegevensController

 @Html.ActionLink(@item.Bedrijfsnaam.ToString(), "Edit", "BedrijfsGegevens", null, new { bedrijfsnummer = (Guid)item.Bedrijfsnummer })

Why?? And what is the proper ActionLink??

Cheers Hans


The issue is simply that you have two Actions with the same name and same parameter count. Try changing the name of one of your Action methods and it should work properly.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号