如何在 ASP.NET 中的嵌套母版页场景中引用主母版
我看到这个问题已经得到回答: ASP.NET MVC 中是否有嵌套母版页?
但如果我有嵌套母版页,我还有一个后续问题:
site.master 节.master 页面
有一个section.master的master,而section.master本身有一个site.master的master,
我可以同时引用section.master和site.master中的节吗?
或者也许更好的问题是我想执行以下操作,当我尝试引用 site.master 中的某个部分时,我得到“找不到内容部分。
有什么建议吗?
我看到页面引用部分.master 的示例但我找不到任何页面引用 site.master 的示例,例如: http://msdn.microsoft.com/en-us/library/x2b3ktt7.aspx
i see that this question has been answered:
Are there nested master pages in ASP.NET MVC?
but i have a follow up questions, if i have nested master pages:
site.master
section.master
page
where page has a master of section.master and section.master itself has a master of site.master
can i refer to sections in both section.master and site.master?
or maybe the better questions is that i would like to the do the following and when i try to reference a section in site.master i get "can't find content section.
any suggestions?
i see examples where the page references section.master but i can't find any examples where page references site.master. For example: http://msdn.microsoft.com/en-us/library/x2b3ktt7.aspx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信如果页面设置了子母版页,您将无法引用父母版页的内容。
相反,您可以将内容从子母版链接到父母版。 像这样:
Top.Master:
Child.Master:
Page.aspx:< /em>
I believe you cannot reference content of parent master page if the page has child master page set.
Instead you can chain the content from child master to parent. Like this:
Top.Master:
Child.Master:
Page.aspx: