-
Accessing Master Page public items
I cannot get this to work in Visual Studio 2005 with ASP.NET v2.0:
==================================================
For example, you might have a master page named MasterPage.master that is the class name MasterPage_master. You might create @ Page and @ MasterType directives that look like the following:
<%@ Page masterPageFile="~/MasterPage.master"%>
<%@ MasterType virtualPath="~/MasterPage.master"%>
When you use a @ MasterType directive, such as the one in the example, you can reference members on the master page as in the following example:
CompanyName.Text = Master.CompanyName;
==================================================
To access items in the Master Page I have to do this on every page:
NameSpace.MasterClass _master = (NameSpace.MasterClass)base.Master;
CompanyName.Text = _master.CompanyName;
Any fix for this ?
Thanks!
-
I just realised that the "designer" files that VS automatically creates does exactly what I was doing manually in the page itself...
NameSpace.MasterClass _master = (NameSpace.MasterClass)base.Master;
All designer pages were deleted in this older project because they created unnecessary complexity; and they still do...
Similar Threads
-
By athomas42 in forum .NET
Replies: 1
Last Post: 06-25-2007, 04:54 PM
-
Replies: 146
Last Post: 08-12-2002, 10:40 PM
-
By Rob Teixeira in forum .NET
Replies: 129
Last Post: 06-06-2002, 05:23 AM
-
Replies: 1
Last Post: 05-23-2002, 07:50 AM
-
By Jan Vettenburg in forum Java
Replies: 1
Last Post: 11-30-2001, 10:57 AM
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks