DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2008
    Posts
    5

    Question 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!

  2. #2
    Join Date
    Dec 2008
    Posts
    5
    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

  1. Submitting Infopath to a .net Web Service
    By athomas42 in forum .NET
    Replies: 1
    Last Post: 06-25-2007, 04:54 PM
  2. How long before the next version??
    By _CAG in forum .NET
    Replies: 146
    Last Post: 08-12-2002, 10:40 PM
  3. Re: App Object (fixes)
    By Rob Teixeira in forum .NET
    Replies: 129
    Last Post: 06-06-2002, 05:23 AM
  4. Object Array ? Do you Worth it
    By ashish in forum Java
    Replies: 1
    Last Post: 05-23-2002, 07:50 AM
  5. JTable Cell Editor
    By Jan Vettenburg in forum Java
    Replies: 1
    Last Post: 11-30-2001, 10:57 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


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


Sponsored Links