Reason for Master Page to Behave like a Usercontrol in ASP.Net

Many times we get confused that Master page is Parent page, but this is not fact.

I was trying to find the sequence of event between Master page and Aspx page (and User control and ASPX page),

then I came to know that sequence of events are same in both the cases

Problem Statement

Why MasterPage Behave like UserControl

Solution

I would like to explain why behavior is same in both of cases:

  1. Base class of Page is System.Web.UI.Page
  2. Base class of Usercontrol is System.Web.UI.UserControl
  3. Base class of MasterPage is System.Web.UI.MasterPage

And Base class of System.Web.UI.MasterPage is UserControl

So from thrid point, Indirectly Masterpage inherit from Usercontrol so it behave like a Usercontrol.

So Masterpages behave like child controls on a page.

Ebook Download
View all
Learn
View all