modify master page from sub page in run time

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
 
E

Eliyahu Goldin

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

Guest

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
 
E

Eliyahu Goldin

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
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top