mvc httppost href parameters
asp.net-mvc, asp.net-mvc-controller, asp.net-mvc-views, c#, c#-4.0
Solution
but since you simply return the link, I advise you to substitute it somehow that way:
<a href='@Url.Action("UitgebreidPersoonScherm", "RelatieZoeken", new { psnID = adres.Id })'>
Problem
I'm currently working in ASP.NET MVC 4 with EF 4.0. I have an unordered list with listitems. Each listitem contains a name and address and is clickable. Now I want to make it so that, when I click the listitem, I go to a new View. This view is called UitgebreidPersoonScherm and is in thesame controller RelatieZoekenController. Here's the code I currently have: Controller: ``` [HttpPost] public ActionResult UitgebreidPersoonScherm(int psnID) { ViewBag.Message = "UitgebreidPersoonScherm"; return View("UitgebreidPersoonScherm"); } ``` View: ``` @model MobileApp.Models.ZoekModel @{ ViewBag.Title = " Resultaten"; } @using (Html.BeginForm("UitgebreidPersoonScherm", "RelatieZoeken", FormMethod.Post, new { id = "resultForm" })) { <ul data-role="listview" data-filter="true" data-inset="true" data-theme="g"> @foreach (var adres in Model.AdresList) { <li> <a href='@Html.Action("UitgebreidPersoonScherm", "RelatieZoeken")'><b>@adres.Naam </b> <br />@adres.Adres </a></li> } </ul> } ``` Now I wouldn't have a clue on how this is possible. I tried to make it with an actionlink, but it wouldn't show my data. If I remove the httppost I can get it to work, but without parameters. Currently it also doesn't give any parameters. If you need any extra information, just ask. Thanks.