Are Nested Master Pages supported in Framework 2.0/VS 2005?

Discussion in 'ASP .Net' started by daveh551, Jul 20, 2008.

  1. daveh551

    daveh551 Guest

    I've seen reference to Nested Master Pages in some of the
    documentation, but I haven't been successful in creating one in VS
    2005 (Framework 2.0). I just did a search on it, and "How To:
    Walkthrough" on Master pages listed VS 2008 and Framework 3.5 as pre-
    requisites.

    If I do an "Add New Item" selecting "Master Page", the "Use
    MasterPage" check box is grayed out, so it won't let me create it in
    VS 2005. Is there a way to "trick it"? Or is it just not supported in
    the framework? (I tried creating a new Master page, and then adding
    the "MasterPage="..." attribute in the head, but it didn't like that.
    And I tried creating a WebForm page, then renaming it from Child.aspx
    to Child.Master, and changing the "Page" in the header to "Master",
    but it didn't like that either.)

    Thanks in advance for any help.
     
    daveh551, Jul 20, 2008
    #1
    1. Advertising

  2. daveh551

    Munna Guest

    Munna, Jul 20, 2008
    #2
    1. Advertising

  3. daveh551

    daveh551 Guest

    On Jul 20, 3:37 am, Munna <> wrote:
    > Hi
    >
    > Check this out
    >
    > http://aspalliance.com/897_Tips_for_Nested_Master_Pages_and_VS_2005_D...
    >
    > "The only downside is that VS 2005 only supports nested master page
    > editing in source-view,
    > and doesn’t support it in the WYWSIWYG designer (note: obviously it
    > does support editing them
    > when the master-pages are not nested)."
    >
    > Best of luck
    >
    > -------
    > Munna
    >
    > www.munna.shatkotha.com/blogwww.munna.shatkotha.comwww.shatkotha.com


    Munna,

    Thanks for that link. It was pretty helpful. But it's still a step
    beyond where I am. Specifically, he says in the first paragraph:

    >For example, you could define a top-level master-page called “MainMaster..master” that defines a >common logo header and footer, and defines a content-placeholder for the page called “content”. >You could then define two sub-masters beneath it


    Okay, I do know how to define the top level master. But how, exactly,
    do you define a submaster?
    I've tried adding a new MasterPage item, then adding a MasterPageFile
    attirbute, and it didn't seem to like that, and I've tried adding a
    new aspx page, then renaming it to Child.master and changing the
    "Page" attribute to "Master", and it didn't like that either.

    I appreciate the help, though. At least I know it CAN be done, and I
    can keep on trying.
     
    daveh551, Jul 20, 2008
    #3
  4. daveh551

    bruce barker Guest

    the trick to remember is that master pages are just control on a page
    that refers to them (they do not contain pages). so a page can refer to
    master1. master1 can refer to master2 (its the content for master2), and
    master2 can refer to master3 and so on.

    -- bruce (sqlwork.com)


    daveh551 wrote:
    > On Jul 20, 3:37 am, Munna <> wrote:
    >> Hi
    >>
    >> Check this out
    >>
    >> http://aspalliance.com/897_Tips_for_Nested_Master_Pages_and_VS_2005_D...
    >>
    >> "The only downside is that VS 2005 only supports nested master page
    >> editing in source-view,
    >> and doesn’t support it in the WYWSIWYG designer (note: obviously it
    >> does support editing them
    >> when the master-pages are not nested)."
    >>
    >> Best of luck
    >>
    >> -------
    >> Munna
    >>
    >> www.munna.shatkotha.com/blogwww.munna.shatkotha.comwww.shatkotha.com

    >
    > Munna,
    >
    > Thanks for that link. It was pretty helpful. But it's still a step
    > beyond where I am. Specifically, he says in the first paragraph:
    >
    >> For example, you could define a top-level master-page called “MainMaster.master” that defines a >common logo header and footer, and defines a content-placeholder for the page called “content”. >You could then define two sub-masters beneath it

    >
    > Okay, I do know how to define the top level master. But how, exactly,
    > do you define a submaster?
    > I've tried adding a new MasterPage item, then adding a MasterPageFile
    > attirbute, and it didn't seem to like that, and I've tried adding a
    > new aspx page, then renaming it to Child.master and changing the
    > "Page" attribute to "Master", and it didn't like that either.
    >
    > I appreciate the help, though. At least I know it CAN be done, and I
    > can keep on trying.
     
    bruce barker, Jul 20, 2008
    #4
  5. daveh551

    daveh551 Guest

    On Jul 20, 2:21 pm, bruce barker <> wrote:
    > the trick to remember is that master pages are just control on a page
    > that refers to them (they do not contain pages). so a page can refer to
    > master1. master1 can refer to master2 (its the content for master2), and
    > master2 can refer to master3 and so on.
    >
    > -- bruce (sqlwork.com)
    >
    > daveh551 wrote:
    > > On Jul 20, 3:37 am, Munna <> wrote:
    > >> Hi

    >
    > >> Check this out

    >
    > >>http://aspalliance.com/897_Tips_for_Nested_Master_Pages_and_VS_2005_D....

    >
    > >> "The only downside is that VS 2005 only supports nested master page
    > >> editing in source-view,
    > >> and doesn’t support it in the WYWSIWYG designer (note: obviously it
    > >> does support editing them
    > >> when the master-pages are not nested)."

    >
    > >> Best of luck

    >
    > >> -------
    > >> Munna

    >
    > >>www.munna.shatkotha.com/blogwww.munna.shatkotha.comwww.shatkotha.com

    >
    > > Munna,

    >
    > > Thanks for that link. It was pretty helpful. But it's still a step
    > > beyond where I am. Specifically, he says in the first paragraph:

    >
    > >> For example, you could define a top-level master-page called “MainMaster.master” that defines a >common logo header and footer, and defines a content-placeholder for the page called “content”. >You could then define two sub-masters beneath it

    >
    > > Okay, I do know how to define the top level master. But how, exactly,
    > > do you define a submaster?
    > > I've tried adding a new MasterPage item, then adding a MasterPageFile
    > > attirbute, and it didn't seem to like that, and I've tried adding a
    > > new aspx page, then renaming it to Child.master and changing the
    > > "Page" attribute to "Master", and it didn't like that either.

    >
    > > I appreciate the help, though. At least I know it CAN be done, and I
    > > can keep on trying.


    Well, I did finally get this to work. Just for anyone following this
    thread:

    I did an "Add New Item", selecting WebForm, and told it to use the
    MasterPage Master.master. But I changes the name from SubMaster.aspx
    to SubMaster.master

    Then I went into SubMaster.master and changed the "Page" directive at
    the top to "Master", and went into SubMaster.Master.cs and changed the
    class that it inherits form System.Web.UI.Page to
    System.Web.UI.MasterPage.

    From there on, it pretty much seems to work as expected.
     
    daveh551, Jul 21, 2008
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Electrified Research
    Replies:
    5
    Views:
    2,469
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
    Oct 11, 2005
  2. Doug McCann
    Replies:
    1
    Views:
    1,039
    William Brogden
    Aug 5, 2004
  3. Replies:
    1
    Views:
    3,224
    PeterKellner
    May 16, 2006
  4. Sam
    Replies:
    0
    Views:
    706
  5. katmagic
    Replies:
    0
    Views:
    1,262
    katmagic
    Dec 26, 2008
Loading...

Share This Page