I’m currently migrating a .net 1.1 application to .net 3.5.
The .net 1.1 application has a number of number of page + usercontrol’s that I would like migrated to masterpages.
My issue is trying to test progmatically to see if the masterpage’s contentplaceholders content has been overridden by a child page.
- Is it possible?
- Does anyone have samples or references that I could take a look at?
Thanks in advance.
A page can communicate with the master page but not vice versa since the content in the contentplaceholder does not belong to the master page. The quickest way of setting up a page “registering” itself to the master page is to declare a class that inherits from the .NET MasterPage and expose communication functionality in that class.
public abstract class MyMaster : System.Web.UI.MasterPage
{
public MyMaster() { }
}
Then in your page that uses the master you can do something like:
Assuming of course that you have a SomeArgs class that contains the data you want the master page to know about.