我正在嘗試將類型爲「EmployeeDocument」的項傳遞給我的操作,但所有值都作爲空值返回,我不確定原因。我試圖通過整個模型以及只是件,他們都是空的,我不知道爲什麼會發生這種情況。模型屬性作爲NULL傳遞到Action
這裏是我的看法是這樣的:
<table id="results-table" class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th>
<u>@Html.DisplayName("Title")</u>
</th>
<th>
<u>@Html.DisplayName("Document Type")</u>
</th>
<th>
<u>@Html.DisplayName("Created By")</u>
</th>
<th>
<u>@Html.DisplayName("Created Date")</u>
</th>
<th style="width: 180px;"></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Title)
</td>
<td>
@Html.DisplayFor(modelItem => item.DocumentType)
</td>
<td>
@Html.DisplayFor(modelItem => item.CreatedBy)
</td>
<td>
@Html.DisplayFor(modelItem => item.CreatedDate)
</td>
<td><a href="@item.FullUrl">View</a> | @Html.ActionLink("Replace", "ReplaceEmployeeDocument", "Employee",new {title = item.Title, doctype = item.DocumentType, createdDate = item.CreatedDate,createdBy = item.CreatedBy, fullUrl = item.FullUrl}) | @Html.ActionLink("Delete", "DeleteEmployeeDocument",new {fileName = item.FullUrl, employeeNo = item.EmployeeNumber})</td>
</tr>
}
</tbody>
</table>
我專注在表中的替換操作鏈接。
這是我的動作是什麼樣子:
[HttpGet]
public ActionResult ReplaceEmployeeDocument(string title, string doctype, DateTime createdDate, string createdBy, string fullUrl)
{
var doc = new EmployeeDocument();
return PartialView(doc);
}
所有的動作參數爲null。這是爲什麼這樣的原因嗎?
user3788671,您可以發佈正在調用ReplaceEmployeeDocument的ActionLink的?謝謝, 條例草案 – BillRuhl 2014-10-27 15:58:08