如何解决这个错误 [英] How resolve this Error

查看:99
本文介绍了如何解决这个错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

"/incometax"应用程序中的服务器错误.
-------------------------------------------------- ------------------------------

内容控件必须是内容页或引用母版页的嵌套母版页中的顶级控件.
说明:执行当前Web请求期间发生未处理的异常.请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息.

异常详细信息:System.Web.HttpException:内容控件必须是内容页或引用母版页的嵌套母版页中的顶级控件.

Server Error in ''/incometax'' Application.
--------------------------------------------------------------------------------

Content controls have to be top-level controls in a content page or a nested master page that references a master page.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Content controls have to be top-level controls in a content page or a nested master page that references a master page.

推荐答案

阅读以下内容:

内容控件必须是内容页面中的顶级控件-ASP.NET 2.0错误 [ ^ ]

master-page- weirdness-content-controls-ha-to-be-top-level-controls-in-a-con [
Read these:

Content controls have to be top-level controls in a content page - ASP.NET 2.0 error[^]

master-page-weirdness-content-controls-have-to-be-top-level-controls-in-a-con[^]

hope it helps :)


您要为此错误的页面必须在其页面属性中为其自身定义了母版页:MasterPageFile="~/MasterPage.master"
完成后,aspx应该具有一个内容"页面,以便母版页可以在渲染时使用它.您的页面设计此处没有任何内容面板.

两种选择:
1.删​​除母版页的页面属性. =>删除MasterPageFile="~/MasterPage.master"
2.在"Declaration_Form.aspx"中添加内容"控件.在该内容中添加页面设计. (如果需要,您可以参考内容页面的设计以查看其他页面.)

在这里阅读有关它们的所有信息:
MSDN:ASP.NET母版页 [
The page for which you are getting this error must have defined a master page for itself in it''s Page attributes: MasterPageFile="~/MasterPage.master"
Once you do it, your aspx should have a Content page such that master page can use it while rendering. Your page design here does not have any content panel in it.

Two options:
1. Remove page attribute for master page. => remove MasterPageFile="~/MasterPage.master" OR
2. Add Content control in your Declaration_Form.aspx. Add you page design in that content. (If needed, you can refer the design of content page looking at other pages.)

Read all about them here: MSDN: ASP.NET Master Pages[^]


这篇关于如何解决这个错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆