Tag: 应用程序代码

基类包括字段但类型与控件类型不兼容

The base class includes the field ‘lbl’, but its type (web.App_Code.CustomLabelControl) is not compatible with the type of control (web.App_Code.CustomLabelControl). 我以同样的方式做了很多自定义控件,但地狱这个错误让我疯了。 我有一个Web应用程序项目,在App_Code目录中具有以下类,在web.config中为类中的控件提供了tagprefix引用。 现在我该怎么做? Web.Config中 … 标记 类文件 namespace web.App_Code { public class CustomLabelControl : Control, IPostBackEventHandler, IPostBackDataHandler { private string _onClickText; public CustomLabelControl() { } public string OnClickText { get { return _onClickText; } set […]

ASP.NET网站无法在App_Code文件夹中看到.cs文件

所以我有一个ASP.NET网站(不是Web应用程序)我在VS2010中用C#制作。 它在我的机器上运行正常,但是当我将它上传到它托管的站点时,它将无法编译,给出:“CS0246:找不到类型或命名空间名称’DataAccess’(你是否缺少using指令或assembly参考?)“ 我一直在使用VS中的复制网站function,并且在我想将自己的类放在App_Code文件夹中并使用它之前没有任何问题。 我在其他答案中读到了将.cs属性更改为“编译”而不是“内容”,但在文件属性中没有这样的选项…只有文件名,完整路径和自定义工具。 这是.cs文件中的代码: using System; using System.Data; using System.Data.SqlClient; using System.Web.Configuration; /// /// Provides access to SQL Server database. /// /// public class DataAccess { //Variables & public properties *********************************** private string connectionString = “”; private int recordCount = -1; /// /// Property: gets count of records retrieved or changed /// public int […]