我正在构建 MVC Storefront 的一个版本。我有两个主题,一个是标准的ui,一个是admin ui。我有一些 HTML Helper 方法,它们将 .ascx 文件传递给 .aspx 文件,就像示例一样,但没有插件。所有的东西都适用于默认主题,但没有一个适用于管理主题。当 Html.SimpleActivityTypeList() 触发时,我总是遇到同样的错误。Html.RenderPartial(“AdminLeftNav”) 将始终正常工作。
<asp:Content ID="Content3" ContentPlaceHolderID="NavContent" runat="server">
<% Html.SimpleActivityTypeList(); %>
<% Html.RenderPartial("AdminLeftNav"); %>
</asp:Content>
我在扩展类中添加了如下方法。
public static void SimpleActivityTypeList(this HtmlHelper helper)
{
helper.RenderAction<CatalogController>(x => x.SimpleActivityTypeList());
}
正如我所说,这在默认主题中效果很好。请帮忙?
Stack Trace:
[ArgumentNullException: Value cannot be null.
Parameter name: httpContext]
System.Web.Routing.RequestContext..ctor(HttpContextBase httpContext, RouteData routeData) +85
Microsoft.Web.Mvc.ViewExtensions.RenderRoute(HtmlHelper helper, RouteValueDictionary values) +367
Microsoft.Web.Mvc.ViewExtensions.RenderAction(HtmlHelper helper, Expression`1 action) +113
GrandGuide.Web.CMSExtensions.SimpleActivityTypeList(HtmlHelper helper) in C:\S3_Depot\S3_Dev\GrandGuide\GrandGuide.Web\Infrastructure\Helpers\CMSExtensions.cs:55
ASP.views_themes_admin_index_aspx.__RenderContent3(HtmlTextWriter __w, Control parameterContainer) in c:\S3_Depot\S3_Dev\GrandGuide\GrandGuide.Web\Views\Themes\Admin\Index.aspx:7
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
ASP.views_themes_admin_theme_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in c:\S3_Depot\S3_Dev\GrandGuide\GrandGuide.Web\Views\Themes\Admin\Theme.Master:33
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer) +71
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266