誰能告訴我爲什麼我在下面的代碼參數總是空當控制器動作被稱爲:MVC ActionLink的參數從未發送
<% foreach (var row in Model) { %>
<tr>
<td><%=Html.ActionLink("Edit", "Edit", "Customer", new { controller = "Customer", action = "Edit", id = row.CustomerID })%>|
<%= Html.ActionLink("Sales", "List", "Sale", new { controller = "Sale", action = "List", id = row.CustomerID }, null)%></td>
<td><%= Html.Encode(row.CustomerID)%> </td>
<td><%= Html.Encode(row.FirstName)%> </td>
<td><%= Html.Encode(row.LastName)%> </td>
<td><%= Html.Encode(String.Format("{0:g}", row.DateOfBirth))%></td>
<td><%= Html.Encode(row.Address)%> </td>
<td><%= Html.Encode(row.Phone)%> </td>
</tr>
<% } %>
控制器代碼:
public class SaleController : Controller
{
public ActionResult List(int CustomerID)
{
SaleListModel SaleList = SaleServices.GetList(CustomerID);
return View(SaleList);
}
}
其作用???? – xandercoded
這兩個操作鏈接都將參數發送爲空 – collusionbdbh