DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2008

    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 ?


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

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
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.