Referencing custom properties on a Master page from the Child page


We have an optional menu which appears on a few of the pages in a site I’m working on at the moment- this additional menu is on the master page and shown/hidden as needed. We’ve added a public property to the master page’s code behind;

public bool DisplayGrownUpsMenu { get; set; } 

On the child pages you can then reference the switch in code like so;

this.Master.DisplayGrownUpsMenu = true;

However, this didn’t initially work- dot net assumed the master page to be of the generic base master page type (System.Web.UI.MasterPage) as opposed to my specific instance of that master page with the extra property (Orchard.Master). As a result, the new DisplayGrownUpsMenu property didnt appear in intellisense and the compiler flagged this as an error. To resolve this you have to add a reference to the specific Master Page type in use, on the aspx side of things by wacking this at the top of the page;

<%@ MasterType VirtualPath="~/Orchard.Master" %>
  1. No comments yet.
(will not be published)


I absolutely love these. They came at the lace wigs are good quality, and very soft. Absolutely love these extensions. I just love this hair. Hair came on time, I waited until after hair extensions uk very full, no shedding and it is been installed for 3 weeks now and yes I jus ordered 3 more bundles. Lol. I definitely recommend this company for your bundles ladies. They are soft, hair bundles on the head for human hair wigs and I would continue to recommend them. I have thinner hair so they cover and blend nicely.