ASP.NET Nested masterpages, how to set content in the top page from the aspx file?

Posted by David Suarez on Stack Overflow See other posts from Stack Overflow or by David Suarez
Published on 2010-04-29T12:38:40Z Indexed on 2010/04/29 13:07 UTC
Read the original article Hit count: 355

Filed under:
|
|

I have some content from a CMS that I need to move to raw asp.net pages. Since the templates are nested I guess I can use nested masterpages to acomplish it, but I'm finding that I can't set values on the top masterpage from the deep child page.

Here is a sample. I have several nested masterpages with contentplaceholders:

  • top master (with contentPlaceHolder1)
  • nested master, dependent on top master (with contentPlaceHolder2)
  • aspx page, dependent on nested master, defines content for contentPlaceHolder1 and 2

The problem is that asp.net doesn't allow me to have the value of contentPlaceHolder1 defined in the content page, it should be defined in the nested master. But the point is that the client page knows that value, not the template masters (for instance, the page knows about the graphic it has to display on the the top, but the placeholder for the graphic is the top master).

How can I set values in the aspx page to be rendered in the top master?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about master-pages