我有一个观点,我将模型传递给。我希望它从模型中的列表中呈现出一个表。它确实很好,它在这种情况下呈现视图,如果我调试它,我可以将值转到正确的位置。但浏览器永远不会更新。如果我在浏览器中按ctrl + R,它会以完全相同的方式再次呈现视图,但这次它会在浏览器中显示列表。我可以在每次视图渲染时进行此更新,以便我不必按ctrl + R吗?
[HttpPost]
public ActionResult CreateResource(ViewModel view)
{
view.ResourceDateCreated = DateTime.Now;
viewmodel = view;
Session["ViewModel"]=viewmodel;
return View("Index", viewmodel);
}
观点:
<table class="table">
<tr>
<th>
MetaDataName
</th>
<th>
MetaDataDescription
</th>
<th>
LanguageCode
</th>
<th>
UserId
</th>
<th>
MetaDataDateCreated
</th>
@*<th>@Html.DisplayNameFor(model => model.MetaList)</th>*@
</tr>
@if (Model.Metadata.Count != 0)
{
foreach (var item in Model.Metadata)
{
<tr>
<td>
@item.MetaDataName
</td>
<td>
@item.MetaDataDescription
</td>
<td>
@item.LanguageCode
</td>
<td>
@item.UserId
</td>
<td>
@item.MetaDataDateCreated.ToString()
</td>
<td>
<table>
<tr>
<th>
MetaListId
</th>
</tr>
@if (item.MetaList.Count != 0)
{
foreach (var list in item.MetaList)
{
<tr>
<td>
@list.MetaListId
</td>
</tr>
}
}
</table>
</td>
</tr>
}
}
</table>