Master Pages - public properties

G

Guest

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";
 
W

Walter Wang [MSFT]

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.
 
G

Guest

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"
 
W

Walter Wang [MSFT]

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.
 
W

Walter Wang [MSFT]

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.
 
C

clintonG

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/
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top