S
shapper
Hello,
I created 2 master pages and a page related as follows:
Master1 > Master2 > MyPage
In MyPage I need to access a user control that I added to Master1 to
change a few of its properties.
For that I created a property in Master1 and a property in Master2:
Master1:
Public Property Nav() As Navigation
Get
Return ucNavigation
End Get
Set(ByVal value As Navigation)
ucNavigation = value
End Set
End Property
Master2:
Public Property Nav() As Navigation
Get
Return Master.Nav
End Get
Set(ByVal value As Navigation)
Master.Nav = value
End Set
End Property
I also added the following code lines in Master1, Master2 and MyPage
aspx code:
Master1:
<%@ Reference VirtualPath="~/Navigation.ascx" %>
Master2:
<%@ MasterType VirtualPath="~/Master1.master" %>
<%@ Reference VirtualPath="~/Navigation.ascx" %>
MyPage:
<%@ MasterType VirtualPath="~/Master2.master" %>
Finally in MyPage Page.Init event I did the following:
Master.Nav.PageName = "Default"
However I see no effects in my code. The property PageName in
ucNavigation control is nothing.
I looked and looked for what I am doing wrong but I can't figure this
out.
Does anyone knows what I am doing wrong?
Thanks,
Miguel
I created 2 master pages and a page related as follows:
Master1 > Master2 > MyPage
In MyPage I need to access a user control that I added to Master1 to
change a few of its properties.
For that I created a property in Master1 and a property in Master2:
Master1:
Public Property Nav() As Navigation
Get
Return ucNavigation
End Get
Set(ByVal value As Navigation)
ucNavigation = value
End Set
End Property
Master2:
Public Property Nav() As Navigation
Get
Return Master.Nav
End Get
Set(ByVal value As Navigation)
Master.Nav = value
End Set
End Property
I also added the following code lines in Master1, Master2 and MyPage
aspx code:
Master1:
<%@ Reference VirtualPath="~/Navigation.ascx" %>
Master2:
<%@ MasterType VirtualPath="~/Master1.master" %>
<%@ Reference VirtualPath="~/Navigation.ascx" %>
MyPage:
<%@ MasterType VirtualPath="~/Master2.master" %>
Finally in MyPage Page.Init event I did the following:
Master.Nav.PageName = "Default"
However I see no effects in my code. The property PageName in
ucNavigation control is nothing.
I looked and looked for what I am doing wrong but I can't figure this
out.
Does anyone knows what I am doing wrong?
Thanks,
Miguel