0
我想將我的Master Page
的<body>
公開給我的Content Pages
。所以我做的:將母版頁中的正文標記暴露給ASP.NET中的內容頁面
Master.aspx
<body id="MasterPageBodyTag" runat="server">
Master.aspx.vb
Public Property Messaging() As Messaging
Get
Return mMessaging
End Get
Set(ByVal value As Messaging)
mMessaging = value
End Set
End Property
Public Property BodyTag() As HtmlGenericControl
Get
Return MasterPageBodyTag
End Get
Set(ByVal value As HtmlGenericControl)
MasterPageBodyTag = value
End Set
End Property
ContentPage.aspx
<%@ MasterType VirtualPath="~/my.master" %>
ContentPage.aspx.vb
Master.BodyTag.Attributes.Add("onload", "MyScript()")
然而,不僅我沒有得到我的內容頁面的BodyTag
但我也接受,我無法訪問Messaging
財產(錯誤的錯誤:不是主人成員),之前工作正常。原因是什麼?