マスターページのメンバーへアクセス
コンテンツページからマスターページの公開メンバーへのアクセス方法です。
まずコンテンツページの.aspxファイル側にMasterTypeディレクティブを設定します。
<%@ Page masterPageFile="~/Site.master" ~~~~ %> <%@ MasterType VirtualPath="~/Site.master" %>
VirtualPathには.masterのファイルパスを指定します。
後は、コンテンツページ側のサーバーサイド処理でPage.Masterプロパティで取得可能です。
//マスターページ public string PageTitle { get; set; } public void Hoge() { } //コンテンツページ Master.PageTitle = "ほげ"; Master.Hoge();