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" %>


    经验在于积累----武二郎
  • 相关阅读:
    SQL注入漏洞
    回发或回调参数无效
    ListView绑定DataSet
    SQL注入漏洞全接触入门篇(二)
    条件运算符
    安全类
    ASP.NET常用代码集锦
    活动目录操作类
    x60系统安装步骤
    程序员是如何喝酒的
  • 原文地址:https://www.cnblogs.com/zhanghai/p/4461247.html
Copyright © 2011-2022 走看看