modify master page from sub page in run time

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi ALL:

i have a master page and two sub pages and master page has a menu with two
links which point to two sub page.
what i wanna to do is that when the sub page shows the link in the menu
change colour.

so how do i chane the colour of master page from sub page?

Cheers

Nick
 
Nick,

You can make a public property MenuColor in the master page. The content
pages can access it as this.Master.MenuColor. You will need to add a
<%@ MasterType virtualpath="~/myMasterPageName.master" %>

direcive to the content file. The master page can change the menu color in
the MenuColor's "set" part.
 
hi Eliyahu Goldin.

Thanks for your reply, which is really helpful.

i actually make it works by using function instead of property.

because i got error like lack of set access when i use property set .

do you know why?

thanks

nick

Eliyahu Goldin said:
Nick,

You can make a public property MenuColor in the master page. The content
pages can access it as this.Master.MenuColor. You will need to add a
<%@ MasterType virtualpath="~/myMasterPageName.master" %>

direcive to the content file. The master page can change the menu color in
the MenuColor's "set" part.


--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]


Nick said:
Hi ALL:

i have a master page and two sub pages and master page has a menu with two
links which point to two sub page.
what i wanna to do is that when the sub page shows the link in the menu
change colour.

so how do i chane the colour of master page from sub page?

Cheers

Nick
 
If you post the code, it will be easier to find the problem.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]


Nick said:
hi Eliyahu Goldin.

Thanks for your reply, which is really helpful.

i actually make it works by using function instead of property.

because i got error like lack of set access when i use property set .

do you know why?

thanks

nick

Eliyahu Goldin said:
Nick,

You can make a public property MenuColor in the master page. The content
pages can access it as this.Master.MenuColor. You will need to add a
<%@ MasterType virtualpath="~/myMasterPageName.master" %>

direcive to the content file. The master page can change the menu color
in
the MenuColor's "set" part.


--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]


Nick said:
Hi ALL:

i have a master page and two sub pages and master page has a menu with
two
links which point to two sub page.
what i wanna to do is that when the sub page shows the link in the menu
change colour.

so how do i chane the colour of master page from sub page?

Cheers

Nick
 
Back
Top