gpt4 book ai didi

asp.net - 母版页出现错误

转载 作者:行者123 更新时间:2023-12-04 06:27:46 24 4
gpt4 key购买 nike

我将 VS2008 用于 ASP.NET 应用程序。

我的解决方案资源管理器具有如下层次结构:

enter image description here

启动页面 Default.aspx 显示登录表单。当我按下登录按钮时,另一个名称为 selectCompany 的页面应该会打开。 selectCompany 是一个 Web 内容表单,其母版页为 Master1.Master。但它没有打开,而是我收到此错误:

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'FlexStock.Forms.master1'.

Source Error:

Line 1: <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="~/Forms/selectCompany.aspx" Inherits="FlexStock.Forms.master1" %>
Line 2:
Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


Source File: /Forms/master1.Master Line: 1

Master1.master 的第一行是这样的:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="master1.master.cs" Inherits="FlexStock.Forms.master1" %>

而Web Content Form的第一行selectCompany.aspx是这样的:
<%@ Page Title="" Language="C#" MasterPageFile="~/Forms/master1.Master" AutoEventWireup="true" CodeBehind="selectCompany.aspx.cs" Inherits="FlexStock.Forms.selectCompany" %>

我没有关注问题出在哪里。

最佳答案

确保 类(class)名称在页面指令的 Inhertis 部分中说明 匹配 您的 中的类(class)名称代码隐藏文件 .

Master1.master:

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="master1.master.cs" Inherits="FlexStock.Forms.master1" %>

Master1.Master.cs:
namespace FlexStock.Forms {
public class master1 {
/* ... */

关于asp.net - 母版页出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5828968/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com