0

I want to expose the <body> of my Master Page to my Content Pages. Therefore I do:

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()")

However, not only I don't get the BodyTag in my content pages but I also receive an error that I cannot access the Messaging property (error: is not a member of Master), that before was working correctly. What can be the cause?

Machavity
  • 30,841
  • 27
  • 92
  • 100
CiccioMiami
  • 8,028
  • 32
  • 90
  • 151

1 Answers1

0

I am not expert at VB. But it seems that you need at first to cast me.Master reference to the Class type of the your custom master page before trying to access properties and method specific to you custom master page. I suppose that in this case automatic custom can't be done. So you can try to do the following:

Dim myCustomMaster As Site = CType(me.Master, Site)

where Site type is custom master class type.

Maxim Kornilov
  • 5,675
  • 1
  • 24
  • 35