我正在开发一个自定义视图引擎,用于为我的 asp.net mvc 2 Web 应用程序实现主题。我面临的问题是在这个函数中:
public override ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName, bool useCache)
参数“masterName”始终为空,尽管 viewName 不为空并且该视图具有与其关联的母版页。
我想知道母版页,所以我可以有一个默认主题并允许创建一个只更改母版页但不更改内容页的主题。So when a theme is selected, I want to use the masterpage of the theme but the content page of the default theme. 但我也希望能够创建覆盖母版页和一些内容页的主题,而其他一些则不是。为此,我只需要页面正在使用的 masterName,但我收到一个空字符串:(
你有什么想法?
提前致谢!胡安