CS1061 局部视图未在 nopcommerce 插件中加载
CS1061 partial view not loaded in nopcommerce plugin
我正在开发 nopcommerce 插件并在母版页中调用部分视图。但加载显示此错误:
CS1061: 'System.Web.Mvc.HtmlHelper' does not contain a
definition for 'Patial' and no extension method 'Patial' accepting a
first argument of type 'System.Web.Mvc.HtmlHelper' could be
found (are you missing a using directive or an assembly reference?)
你好像打错了。您正在使用 @Html.Patial("myview")
而不是 @Html.Partial("myview")
根据评论,您收到以下错误:
The partial view 'vendorProfile' was not found or no view engine
supports the searched locations. The following locations were
这意味着它在找不到名为 "vendorProfile" 的视图的位置进行搜索,因此将该视图放入 ~/Themes/twigoh/Views/Dashboard/
或者您可以 return 从您的插件中查看部分视图,例如:
PartialView("~/Plugins/Twigoh.Sellers/Views/Dashboard/vendorProfile.cshtml", model);
但是 在主视图中加载时显示错误,因为它试图在共享文件夹中查找但未获取该视图。因此,与其调用 @Html.Partial
,不如使用 @Html.RenderAction
,或者将该视图复制到共享文件夹。
希望对您有所帮助!
我正在开发 nopcommerce 插件并在母版页中调用部分视图。但加载显示此错误:
CS1061: 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'Patial' and no extension method 'Patial' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a using directive or an assembly reference?)
你好像打错了。您正在使用 @Html.Patial("myview")
而不是 @Html.Partial("myview")
根据评论,您收到以下错误:
The partial view 'vendorProfile' was not found or no view engine supports the searched locations. The following locations were
这意味着它在找不到名为 "vendorProfile" 的视图的位置进行搜索,因此将该视图放入 ~/Themes/twigoh/Views/Dashboard/
或者您可以 return 从您的插件中查看部分视图,例如:
PartialView("~/Plugins/Twigoh.Sellers/Views/Dashboard/vendorProfile.cshtml", model);
但是 在主视图中加载时显示错误,因为它试图在共享文件夹中查找但未获取该视图。因此,与其调用 @Html.Partial
,不如使用 @Html.RenderAction
,或者将该视图复制到共享文件夹。
希望对您有所帮助!