Hi!
I've tried to copy the example from http://fredrik.nsquared2.com/ViewPost.aspx?PostID=123, but somehow it doesn't work out properly.
I have two files: MasterPage.master with the following header:
<%@ Master Language="C#" ClassName="MasterPage_master" %>
The reason, why I have not just copied the text from the webpage one-to-one, is that VisualWebDeveloper throws an error caused by the attribut "compilewith".
The source-file of my masterpage is this:
public partial class MasterPage_mast : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
public string Name
{
get { return "The Base Master Page"; }
}
}
Secondly, I have my page login.aspx.
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="login.aspx.cs" Inherits="login" Title="Untitled Page" %>
<%@ MasterType virtualPath="MasterPage.master" %>
and Code-Page:
public partial class login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(Master.Name());
}
}
I get the error: ASP.MasterPAge_master has no definition for Name.
I would be glad, if somebody can explain me where the error in this little example is hidden.
Thank you very much in advance!
Frank