c# - How do I reference an ASP.net MasterPage from App_Code -


I am working on a .NET 3.5 site, standard website project.

A custom page class in the site I wrote is the App_Code folder (MyPage).

I also have a master page with the property.

  Public partial class MyMaster: System.Web.UI .MasterPage {... private string page id = ""; Public String Page Id {Get Return Page ID; } Set {pageID = value; }}}  

I am trying to refer this property to a property in MyPage.

  Public class MyPage: System.Web.UI.Page {... Public String PageID {Set {(MyMaster) Master) .PageID = Value; } Received {Return ((MyMaster Master)). PGID; }}}  

I could not find the "end" name or namespace name 'mieMaster'. I've found a page on MyMaster instead of using FindControl (), but can change the ID in the main page.

I have done the following work with the Web site projects:

Make App_Code the following:

BaseMaster.cs

  System Public class betamster using Web.UI: MasterPage {public string migration {get; Set;}}  

Basepj. Cs:

 using ; Web. UI; Public class is using basepage: Page {secure zero page_load (object sender, eventArgse E) {if (empty! = Master and masters is bessmaster) {(master of bassmaster). Mystring = "some value";}}}  

My master pages are then obtained from the basemaster:

  using the system; Public Partial Class Masters_MyMasterPage: Bassmaster {Secure Zero Page_load (Object Sender, EventArgs E) {if String.IsNullOrEmpty (MyString)} {// Anything}}  

and my page basepage From:

  Public Partial Class _Default: BasePage  

Comments