You cannot link to MyMasterPage unless you place it also in App_Code. Usually in this situation, you should create a basic master page that inherits from MasterPage. eg.
public partial class MasterPageBase : System.Web.UI.MasterPage
{
public virtual void DoSomething() { }
}
- System.Web.UI.MasterPage MasterPageBase. .
public partial class MyMasterPage : MasterPageBase
Class1, ( , Master_Page, ...
public class Class1
{
public Class1(Page Target)
{
MasterPageBase _m = (MasterPageBase)Target.MasterPage;
_m.DoSomething();
}
}
, , , ASP.NET.