473,387 Members | 1,760 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Master Page Properties

I'm looking at this book on Professional ASP.Net 2.0 (Wrox) and it indicates
that if I want to alter a control property which is on the master page, that
I need to create a public property on the master page which returns the
desired control.

I have done this, but Intellisense does not show me this property, nor will
the application compile when I reference it as follows:

Master.MyControl.Text = "Fred";

What am I missing?

Nov 10 '06 #1
4 1175
"Jim Heavey" <Ji*******@discussions.microsoft.comwrote in message
news:23**********************************@microsof t.com...
Master.MyControl.Text = "Fred";
((TextBox)Master.MyControl).Text = "Fred";
Nov 10 '06 #2
The issue is that "Master.MyControl" is not a valid object. The issue is not
that I need to reclass the object to a text box.

Why is master.mycontrol not recognized as a valid object.

In my Master page I set up a property as follows:

public Label MyControl
{
get { return lbl1; }
}
Nov 10 '06 #3
You have to declare a @ Mastertype to access members on Masterpages from
contentpages.

See this article: http://msdn2.microsoft.com/en-us/library/c8y19k6h.aspx
I think it explains what you need to do..

Martin Gregersen
WebShine A/S
gr*******@webshine.dk
"Jim Heavey" <Ji*******@discussions.microsoft.comwrote in message
news:87**********************************@microsof t.com...
The issue is that "Master.MyControl" is not a valid object. The issue is
not
that I need to reclass the object to a text box.

Why is master.mycontrol not recognized as a valid object.

In my Master page I set up a property as follows:

public Label MyControl
{
get { return lbl1; }
}

Nov 10 '06 #4
Thanks

Nov 10 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Steve Franks | last post by:
I am trying to access strongly typed properties in a page's master page from the content page. I followed an article that describes how to do this, and it seems quite straight forward. However...
4
by: Steve Franks | last post by:
I have this cool nested master page scenario working great. However what is the correct way to be able to access a strongly typed property at the top level master from a content page that has a...
2
by: Mark Rae | last post by:
Hi, It's easy enough to get a content page to refer to public properties on its associated master page e.g. public partial class master_secure : System.Web.UI.MasterPage { public Label...
4
by: Boris Yeltsin | last post by:
OK, on my Master Page I have a control: <a id="hypTabAccount" href="#" runat="server">Account</a> Now, in the code-behind (Root.master.vb) I can refer to it simply thus: ...
4
by: Suresh | last post by:
Is there any way to access the custom properties of a master page from the aspx form? I know the custom properties of a master page can be accessed from the aspx.cs partial class by specifying...
4
by: evantay | last post by:
I'm using ASP.NET 2.0 with VS.NET 2005. I'm trying to access properties from my master pages within a page that inherits from that master page (a child page). However the values are always null....
0
by: dixonjm | last post by:
Hi, I have a master page & various pages that will use this master page. Each content page will have a CSS & JS file which will be named the same as the content page. When I try to load the CSS...
3
by: Mick Walker | last post by:
Hi All, I have a user control on my master page, which exposes 3 public properties (all boolean). Basically by the values of these properties, the user control builds a menu to for users to...
4
by: lichaoir | last post by:
I have two questions about the use of Master Page: 1. How to access properties and controls in the master page from content page? (I know I can use the "FindControl()" method of the "Master"...
4
by: Seth Williams | last post by:
If I have some Master Page properties, and assign them when the master page first loads, knowing that I can access these property values in the current Content pages, will these properties be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.