Why this.Page.Master is not working when I set the MasterType?
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 rec开发者_开发百科ognized.
Since "this.Page" and "this" references the same object, my question is why does both alternatives do not work? How does MasterType magic work?
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.
精彩评论