Access Master Pages from Ascx directly

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
 
B

Brock Allen

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.
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top