understanding master pages

D

Diego

Hi all
I'd like to understand something about master pages:
1)Why if if try to typecast a masterpage inside a "child page" the compiler
tells it dont find the class? I was trying to declare a property in the
master and access it from the child but the problem is not with the
property, is with the typecast of the class
2)Why both master page and child pages are declared as partial class?
3)Why the events in the Master pages are "created" by Visual Web Developer
2005 EE in the aspx page and not in the codebehind one?
Thanks, Diego
 
B

Brock Allen

The Master and Page get merged together in terms of their control hierarchys
but they're not related via inheritance. But you can have one access the
other as objects. In the child ASPX you want to add the directive:

<%@ MasterType VirtualPath="~/MasterPage.master" %>

The in your ASPX just use Page.Master.SomePublicProp to access the data form
the master.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top