The base class includes the field '...', but its type (...) is not compatible with the type of control (...)

When you try to run a Microsoft ASP.NET 2.0 Web application that is built on the Microsoft .NET Framework 2.0, you may receive an error message that resembles one of the following error messages:

The base class includes the field 'MyControl_1', but its type (MyControl) is not compatible with the type of control (ASP.MyControl_ascx).

Unable to cast object of type 'ASP.MyControl_ascx' to type 'MyNameSpace.MyControl '.

Circular file references are not allowed.

Note In these error messages, MyControl is the name of the control that has caused the error. MyNameSpace is the name of the namespace that this control is a member of

This is problem occurs because of the way in which ASP.NET 2.0 uses the application references and the folder structure of the application to compile the application. If the batch property of the <compilation> element in the web.config file for the application is set to true, ASP.NET 2.0 compiles each folder in the application into a separate assembly. In this scenario, a circular reference may occur. Additionally, the compilation process may fail if either of the following conditions is true:
  • The application contains references to Web controls.
  • The application contains references to Web pages that are outside the current directory.
To resolve this problem, use the following method:

Method : Modify the web.config file

<script type="text/javascript"> loadTOCNode(2, 'resolution'); </script>To modify the web.config file, set the batch property of the <compilation> element in the web.config file for the application to false.
<compilation  batch="false" .... >

For more information about how to use the <compilation> element in the web.config file, visit the following Microsoft Developer Network (MSDN) Web site: http://msdn2.microsoft.com/en-us/library/s10awwz0.aspx
<script type="text/javascript"> </script> <script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"> </script>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值