Access Master Pages from Ascx directly

  • Thread starter Thread starter xs
  • Start date Start date
X

xs

Hi,

Is it possible to access Master Pages from Ascx directly? In an Aspx, by
entering the following ,
<%@ MasterType VirtualPath="~/Pages/Master.Master"%> , I can easily access
its property using this.Master.
But can I do that using Ascx controls? What can I do to access it directly?

Thanks
 
User controls have access to the page and from that you can access the master
via Page.Master. You won't have right type, but if your Master implements
a common interface or dervies from a common base class then you can always
downcast it.

-Brock
http://staff.develop.com/ballen
 

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

Back
Top