Change Property Value

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:

<% [at] Reference VirtualPath="~/Navigation.ascx" %>

Master2:

<% [at] MasterType VirtualPath="~/Master1.master" %>
<% [at] Reference VirtualPath="~/Navigation.ascx" %>

MyPage:

<% [at] 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
Shapper [ Di, 22 April 2008 02:38 ] [ ID #1947343 ]

Re: Change Property Value

On Apr 22, 1:38 am, shapper <mdmo... [at] gmail.com> wrote:
> 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:
>
> <% [at] Reference VirtualPath="~/Navigation.ascx" %>
>
> Master2:
>
> <% [at] MasterType VirtualPath="~/Master1.master" %>
> <% [at] Reference VirtualPath="~/Navigation.ascx" %>
>
> MyPage:
>
> <% [at] 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?
Shapper [ Di, 22 April 2008 17:18 ] [ ID #1947405 ]
Microsoft » microsoft.public.dotnet.framework.aspnet » Change Property Value

Vorheriges Thema: ASP.NET Web Projects retrieved from Repository
Nächstes Thema: Need advice: Stored Proc vs SQL Code vs GUI