我的母版页继承自一个名为MasterParent的类。在编译期间,我收到如下错误:
编译错误:
描述:编译服务此请求所需的资源时发生错误。请查看以下特定错误详细信息并相应地修改源代码。
编译器错误消息:ASPNET:确保此代码文件中定义的类与'inherits'属性匹配,并且它扩展了正确的基类(例如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.
答案 0 :(得分:0)
partial
的每个定义都没有MasterPage : MasterParent
修饰符。