zoukankan      html  css  js  c++  java
  • The base class includes the field '***', but its t

    今天在编译ASP.NET项目的时候突然出现The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is not compatible with the type of control (ASP.common_webusercontrol_ascx) 的错误信息,上网搜索了一下,有两种可能的原因:

      一个是类不能循环引用,否则会发生编译错误,重新组织文件夹和文件,修改有循环引用的地方(我没有遇到这种情况);

      一个是在定义UserControl的时候,直接复制粘贴了曾经的代码,传统模式时,UserControl第一行声明应该是

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl1.ascx.cs" Inherits="HighwayShanxiWeb.WebUserControl1" %>

      而在编译模式下,CodeFile不再起作用,毕竟最后所有类都被打包成程序集,因此这里要把CodeFile属性替换为CodeBehind属性,即修改成如下代码即可

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs" Inherits="HighwayShanxiWeb.WebUserControl1" %>


    经验在于积累----武二郎
  • 相关阅读:
    Fiddler界面详解
    Windows平台下Java,tomcat安装与环境配置
    为什么要装Tomcat?
    实例五租房子
    实例四投票
    易犯的PHP小错误及相应分析
    MYSQL数据库错误代码提示汇总
    php mysql_insert_id()
    实例三搜索
    实例二增删改查
  • 原文地址:https://www.cnblogs.com/zhanghai/p/4461247.html
Copyright © 2011-2022 走看看