[thelist] asp/c#/.net master page
Chris Marsh
chris.marsh at priocept.com
Tue Apr 29 12:02:06 CDT 2008
Laura
[..]
> //And finally on the content page, we add this snippet on the Load
> event.
>
> myMasterPage myMaster = (myMasterPage)this.Master;
Here the author is obtaining a reference to the master page; which
requires a cast.
> myMaster.mainTitle = "Playing with master pages :)";
Here the author is assigning a value to a property of the master page
referenced in the line above.
> The problem I am having with it is the writer doesn't tell us what he
> named his asst pages.
> I have a master page named MasterPage1.master. I have replaced
Check that your master page contains the following directive:
<%@ Master Language="C#" AutoEventWireup="true"
CodeFile="MasterPage1.master.cs" Inherits="MasterPage1" %>
Check that the file MasterPage1.master.cs does actually contain the
definition of a type named MasterPage1.
Check that your page directive contains the following:
MasterPageFile="~/MasterPages/MasterPage1.master"
If all of this is correct, then the following will work for you:
MasterPage1myMaster = (MasterPage1)this.Master;
MasterPage1.mainTitle = "Playing with master pages :)";
Don't forget that C# is case sensitive, so check all of your casing
thoroughly.
> different words
> in the above with "MasterPage1", but am not getting far. I am sure
this
> is a
> silly-easy question, but, since this is a new area for me, I am lost.
>
> Can someone here offer me how I should be wording this code?
If the instructions above do not solve your problem, can you post the
error that you are receiving please?
Cheers!
Chris Marsh
chris.marsh at priocept.com
________________________________________________________________________
Confidentiality notice:
This email and/or any attached document(s) is confidential and intended
only for the person to which it is addressed. It may contain privileged
and/or confidential information. Any review, retransmission,
dissemination or other use of this information by persons other than the
intended recipient is prohibited.
________________________________________________________________________
More information about the thelist
mailing list