当前上下文中不存在名称'PartialView'

问题描述 投票:0回答:1

我正在追踪Phil Haack's tutorial以建立一个Html.Action

[ChildActionOnly]
public async Task<ActionResult> DisplayProductMapTable(long onlineStoreId)
{
    var productMapViewModels = await _shopifyProductService.LoadProductMapViewModels(onlineStoreId);
    return PartialView("_ProductMapTable", productMapViewModels);
}

我不知道为什么在尝试返回PartialView时出现编译错误:

名称“ PartialView”在当前上下文中不存在

并且Visual Studio IntelliSense给我的建议是:

用'PartialViewResult'替换'ParialView'

为什么会出现此错误?我看过太多教程返回PartialView

c# asp.net-mvc asp.net-mvc-5 partial-views child-actions
1个回答
0
投票

本教程指向:

[ChildActionOnly]
public ActionResult DisplayProductMapTable(long onlineStoreId)
{
    var productMapViewModels = _shopifyProductService.LoadProductMapViewModels(onlineStoreId);
    return PartialView("_ProductMapTable", productMapViewModels);
}
© www.soinside.com 2019 - 2024. All rights reserved.