0

我的母版页继承自一个名为 MasterParent 的类。在编译期间,我收到如下错误:

编译错误:

说明:在编译服务此请求所需的资源期间发生错误。请查看以下特定错误详细信息并适当修改您的源代码。

编译器错误消息:ASPNET:确保此代码文件中定义的类与“继承”属性匹配,并且它扩展了正确的基类(例如 Page 或 UserControl)。

源错误:

Line 8:  namespace PortfolioApplication
Line 9:  {
Line 10:     public partial class MasterPage : MasterParent
Line 11:     {
Line 12:     }

我的代码:MasterParent.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PortfolioApplication
{
    public abstract class MasterParent : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        #region "Navigation Buttons"

        protected void btnPortfolio_Click(object sender, EventArgs e)
        {
            Server.Transfer("Portfolio.aspx");
        }
        protected void btnHome_Click(object sender, EventArgs e)
        {
            Server.Transfer("Default.aspx");
        }
        protected void btnContact_Click(object sender, EventArgs e)
        {
            Server.Transfer("Contact.aspx");
        }
        protected void btnResume_Click(object sender, EventArgs e)
        {
            Server.Transfer("Resume.aspx");
        }

        #endregion
    }
}

MasterPage.master.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PortfolioApplication
{
    public class MasterPage : MasterParent 
    {

    }
}

另外:我刚刚尝试在 MasterParent.cs 中为类头更改我的代码:

public partial class MasterPage: System.WEb.UI.MasterPage and i am getting the same error about inheritence.
4

1 回答 1

0

您没有对. 的partial每个定义都有修饰符MasterPage : MasterParent

于 2012-11-01T19:37:26.347 回答