views:

11

answers:

1

I have an aspx page which is linked to a MasterPage.

If I write "this.Master" Visual Studio autocopletes the MasterPage's properties and I can access its properties.

But If I write "this.Page.Master" Visual Studio does not autocomplete and I also get a compilation Error when I try to use any MasterPage's property because it is not recognized.

Since "this.Page" and "this" references the same object, my question is why does both alternatives do not work? How does MasterType magic work?

+1  A: 

You say you're coding on an aspx page, so.

The 'this' keyword is like saying 'Page'. Hence the reason why this.Master works, and this.Page.Master doesn't. You're saying, more or less, Page.Page.Master - which is not recognized, of course.

TheGeekYouNeed