Reputation: 352
Currently I have two MasterPages. One is the child of the other.
Parent:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Parent.master.cs" Inherits="Parent.Parent" %>
Parent Code Behind:
namespace Project
{
public partial class Parent: System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
Child:
<%@ Master Language="C#" MasterPageFile="~/Parent.Master" AutoEventWireup="true" CodeBehind="Child.master.cs" Inherits="Child.Master" %>
Child Code Behind:
public partial class Child : System.Web.UI.MasterPage {
I'm still getting "Parser Error Message: 'UserMasterPage' is not allowed here because it does not extend class 'System.Web.UI.MasterPage'"
Any Help?
Upvotes: 1
Views: 66
Reputation: 1610
UPDATED with new information
If your class is declared as
namespace Project
{
public partial class Parent: System.Web.UI.MasterPage
{
than you should inherit from the Project namespace and then the class Parent:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Parent.master.cs" Inherits="Project.Parent" %>
They must have a direct match otherwise it will not find the class for your master page.
Examples: In the scenario where you have your class inside of a namespace:
namespace Project {
public partial class Parent : System.Web.UI.MasterPage {
you will use Project.Parent
But if you just have:
public partial class Child: System.Web.UI.MasterPage {
Then you will just use Child
Upvotes: 1