【问题标题】:" "is not allowed here because it does not extend class 'System.Web.UI.Page'" "这里不允许,因为它没有扩展类 'System.Web.UI.Page'
【发布时间】:2019-11-01 02:15:40
【问题描述】:

所以我需要开发一个 Web 表单来从扫描仪中获取数据。但是我遇到了一个问题,指出这里不允许使用“”,因为它没有扩展类“System.Web.UI.Page”。 因为我知道这个话题已经讨论过了,我仍然无法解决它。

我已经尝试了这些步骤,但这些都不起作用..

  1. Webform not allowed because it does not extend Class

  2. Parser Error: '_Default' is not allowed here because it does not extend class 'System.Web.UI.Page' & MasterType declaration

  3. Webform not allowed because it does not extend Class

并且已经浏览了这个https://weblog.west-wind.com/posts/2005/Sep/12/Understanding-Page-Inheritance-in-ASPNET-20 以了解更多关于继承的信息。

这是 lalala.aspx 文件

<%@ Page Language="C" AutoEventWireup="true" CodeBehind="lalala.aspx.cs" Inherits="TEST.lalala" %>

这是 lalala.aspx.cs 文件

namespace TEST
{
public partial class lalala : Form
{
// 
}
}

我真的认为这个错误是由页面继承引起的,但我不知道如何解决它.. 请有人指导我

【问题讨论】:

标签: c# asp.net webforms


【解决方案1】:

试试这个(假设您没有使用母版页):

namespace TEST
{
    public partial class lalala : System.Web.UI.Page
    {

    }
}

【讨论】:

  • 是的——尽管它被称为“Web 表单”,但所有页面/表单的基类都是 Page
猜你喜欢
  • 1970-01-01
  • 2010-12-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-02-22
  • 1970-01-01
相关资源
最近更新 更多