By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,333 Members | 1,381 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,333 IT Pros & Developers. It's quick & easy.

Master Pages - public properties

P: n/a

Hello I am having trouble accessing a public porperty that my master page
exposes
I try to access it in a content page but the property is not visible through
intell sense.

Master Page
'''''''''''''''''''''''''''''''''''''

string m_PageHeadingTitle = "My Company";

public string PageHeadingTitle
{
get
{
return m_PageHeadingTitle;
}
set
{
m_PageHeadingTitle = value;
}
}

'''''''''''''''''''''''''''''''
Conent Page

Master.PageHeadingTitle = "Test Page title";

--
Life in the sun
May 12 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Hi,

Thank you for posting!

You need to use the MasterType directive in your content page to create a
strongly typed reference to the ASP.NET master page when the master page is
accessed from the Master property. Here's a sample usage:

<%@ MasterType VirtualPath="~/MasterPage.master" %>

Regards,

Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

May 12 '06 #2

P: n/a
Thanks Walter
I get a error when trying to introduce this directive

<%@ Page Language="C#" MasterType VirtualPath="~/MasterPage.master"
MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
CodeFile="Content01.aspx.cs" Inherits="Content01" Title="Untitled Page"
Theme="Summer" %>
"Master type is not a valid attribute of element page"


--
Life in the sun
"Walter Wang [MSFT]" wrote:
Hi,

Thank you for posting!

You need to use the MasterType directive in your content page to create a
strongly typed reference to the ASP.NET master page when the master page is
accessed from the Master property. Here's a sample usage:

<%@ MasterType VirtualPath="~/MasterPage.master" %>

Regards,

Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

May 12 '06 #3

P: n/a

Hi,

This is a directive just like the Page directive, so you need to put it in
a separate <%@ %> pair:

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true"
CodeFile="Content01.aspx.cs" Inherits="Content01" Title="Untitled Page"
Theme="Summer" %>
<%@ MasterType VirtualPath="~/MasterPage.master" %>

If there is anything unclear, please feel free to post here.

Regards,

Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

May 12 '06 #4

P: n/a
Walter,
You are the man , in now works thanks
--
Life in the sun
"Walter Wang [MSFT]" wrote:

Hi,

This is a directive just like the Page directive, so you need to put it in
a separate <%@ %> pair:

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true"
CodeFile="Content01.aspx.cs" Inherits="Content01" Title="Untitled Page"
Theme="Summer" %>
<%@ MasterType VirtualPath="~/MasterPage.master" %>

If there is anything unclear, please feel free to post here.

Regards,

Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

May 12 '06 #5

P: n/a
Hi,

Appreciate your update and response. I am glad to hear that the problem has
been fixed. If you have any other questions or concerns, please do not
hesitate to contact us. It is always our pleasure to be of assistance.

Have a nice day!
Regards,

Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

May 12 '06 #6

P: n/a
Gee I hope this guy WayDownUnder you misled comes back to read these
comments Walter. Why didn't you tell him he didn't need to write properties
to access the Page title?

// In Page_Load this is all that is needed...
Page.Title = "Whatever";

There's also some clever developers who have documented how to use the
SiteMap file as the meta data for the Page.Title property which is already
public.

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/

"Walter Wang [MSFT]" <wa****@online.microsoft.com> wrote in message
news:Os****************@TK2MSFTNGXA01.phx.gbl...
Hi,

Appreciate your update and response. I am glad to hear that the problem
has
been fixed. If you have any other questions or concerns, please do not
hesitate to contact us. It is always our pleasure to be of assistance.

Have a nice day!
Regards,

Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.

May 12 '06 #7

P: n/a
ClintonG,
The post was a wee bit misleading. It wasnt the page title I was really
interested in ,
I just used that as an example. It was accessing public properties in
general that I wanted to know about.
Thanks

--
Life in the sun
"clintonG" wrote:
Gee I hope this guy WayDownUnder you misled comes back to read these
comments Walter. Why didn't you tell him he didn't need to write properties
to access the Page title?

// In Page_Load this is all that is needed...
Page.Title = "Whatever";

There's also some clever developers who have documented how to use the
SiteMap file as the meta data for the Page.Title property which is already
public.

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/

"Walter Wang [MSFT]" <wa****@online.microsoft.com> wrote in message
news:Os****************@TK2MSFTNGXA01.phx.gbl...
Hi,

Appreciate your update and response. I am glad to hear that the problem
has
been fixed. If you have any other questions or concerns, please do not
hesitate to contact us. It is always our pleasure to be of assistance.

Have a nice day!
Regards,

Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.


May 15 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.