Skip to main content

Tips -Master Page

ASP.NET master pages are pretty handy and here is a simple tip to make them even easier to use.

Using the MasterType reference in your content page allows you to refer to your master page properties without having to cast it to your master page type everytime.

For example...


<%@ MasterType TypeName="myMasterType" %>

allows me to write...


this.Master.myProperty = "value";

rather than...


((myMasterType)this.Master).myProperty = "value";

Which saves you a little typing and provides intellisense

Comments

Popular posts from this blog