Re: How can I access a Master Page Public Property from a Base Page



On Nov 9, 12:03 pm, Jay Pondy <jpo...@xxxxxxxxxxxxxxxxxxxx> wrote:
I am trying to access a Public property on a Master Page from a Base Page.

On the content pages I have the MasterType Directive set up as follows:
<%@ MasterType virtualpath="~/Master.master" %>

On the Master Page I have a public property exposed:
Public Property ErrorMessage() As String
Get
Return txtError.InnerText
End Get
Set(ByVal value As String)
txtError.InnerText = value
rowError.Visible = True
End Set
End Property

From the Content Page I can access the property:
Me.Master.ErrorMessage = "Some Error Message."

If I try and access the Master Page Property from an inherited Base Page with:
Me.Master.ErrorMessage = "Some Error Message."
the IDE highlights the error with:
ErrorMessage is not a member of System.Web.UI.MasterPage

Is there some way I can cast the Base Page Master property to the strongly
typed Master Page and access the ErrorMessage property?

Dim myMaster As New {masterClassName}
myMaster.ErrorMessage = "Some Error Message."

.



Relevant Pages


Loading