Change Property Value

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
 
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

Please, anyone?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top