我有一个链接女巫我想你变成一个按钮,链接通过一个参数,看起来如下:
@Html.ActionLink("View", "Print", new { id = item.SalesContractId })
我现在想用这个参数{ id = item.SalesContractId }的按钮替换它
我的按钮如下所示:
<input type="button" value="Print" id="btnFromIndexPrint" />
有人可以告诉我我该怎么做吗?
这是我的页面的外观,因此您可以看到我想要实现的目标:
@model IEnumerable<Contract.Models.tbSalesContract>
<!DOCTYPE html>
<html>
<head>
<title>Index</title>
</head>
<body>
<p>
@Html.ActionLink("Create New", "Edit")
</p>
<table>
<tr>
<th>
Company
</th>
<th>
Trading As
</th>
<th>
Created
</th>
<th>
Updated
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.CompanyName)
</td>
<td>
@Html.DisplayFor(modelItem => item.TradingAs)
</td>
<td>
@Html.DisplayFor(modelItem => item.C_date)
</td>
<td>
@Html.DisplayFor(modelItem => item.C_updateDate)
</td>
<td>
@* @Html.ActionLink("View", "Edit", new { id = item.SalesContractId }) *@
<input type="button" value="View" id="btnFromIndexView" />
<td>
@* Add Button to print only if contract state is finalized *@
@if (item.IsFinal)
{
@Html.ActionLink("Print", "Print", new { id = item.SalesContractId })
<input type="button" value="Print" id="btnFromIndexPrint" />
}
</td>
</td>
</tr>
}
</table>
</body>
</html>