I have a table that I need to add links to. The links need to go to an HTTPPost actionResult on my controller. I have a huge list that the user needs to be allowed to click on the status, hit the controller and route to the appropriate page afterward. @Html.ActionLink is an HttpGet action. Is there an equivalent for a post?
<table class="table table-striped table-bordered">
<th>Ssn</th>
<th>State</th>
<th>File Uploaded Date</th>
<th>Claim Status</th>
@foreach (var currentClaim in Model.CurrentClaims)
{
<tr >
<td><span name="Ssn">@currentClaim.SSN</span></td>
<td>@currentClaim.StateName</td>
<td>@currentClaim.ClaimDate</td>
<td>@Html.ActionLink(@currentClaim.ClaimStatus, "SubmitClaim", "Claim", FormMethod.Post, new ClaimInputModel { SSN = currentClaim.SSN, StateId = currentClaim.StateId })</td>
</tr>
}
</table>
I tried using
@using("SubmitClaim", "Claim", FormMethod.Post, new ClaimInputModel { SSN = currentClaim.SSN, StateId = currentClaim.StateId })
{
<button type="submit" >xxx</button>
}
I get an HttpCompiler error with this.
You need to use the
BeginForm()HtmlHelper that returns aMvcFormwhich implementsIDisposable…