У меня есть этот контроллер:Обновление Частичный вид MVC4
public ActionResult PopulateTreeViewModel()
{
MainModelPopulate mainModelPopulate = new MainModelPopulate();
// populate model
return View(mainModelPopulate);
}
То есть мнение так:
@model xxx.xxx.MainModelPopulate
<table>
@foreach (var item2 in Model.CountryList)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item2.CountryName);
</td>
</tr>
foreach (var item3 in item2.BrandList)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item3.BrandName);
</td>
</tr>
foreach (var item4 in item3.ProductList)
{
<tr>
<td>
@Html.ActionLink(item4.ProductName, "FunctionX", new { idLab = item3.BrandID, idDep = item4.ProductID });
</td>
</tr>
}
}
}
</table>
Контроллер функции х, как это:
public ActionResult FunctionX(int idBrand=1 , int idProd=1)
{
List<ListTypeModel> typeModelList = new List<ListTypeModel>();
// populate typeModelList
return PartialView(typeModelList);
}
}
с этим частичным вид:
@model IEnumerable<TControl.Models.ListTypeModel>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.Name)
</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
</tr>
}
</table>
Я хочу, чтобы добавить этот частичный вид в моем главном окне (PopulateTreeViewModel) и обновить таблицу с относительным типом продукта, содержащегося в функции X.
Я попытался также заменить @ Html.ActionLink с @ Ajax.ActionLink и он выполняет то же самое.