views:

20

answers:

2

Hi There,

I have a main master page, say MasterPageMain, and a couple of folders with couple of pages in each folder which act as a child page to that master page - MasterPageMain.

Now, I have about 10 pages in one of the folder which follows a certain pattern and they could really use a nested pages since any change on some parts needs me to change all the pages which is a pain really.

I already added a Nested master page, say NestedMasterPage - which is a child of MasterPageMain

I tried to change one of the page's <%@ Page directive to NestedMasterPage, immediately, there were a lot of errors. plus I dint know where the NestedMasterPage's children content would go.

What do I need to know in order to do this succesfully?

Thanks!

ps: I dint do this initially because I only had 2 pages, and I dint need this at that time, as the project grew, now i see that I should have changed it much earlier..

A: 

In the sub master page add a reference to the main master page and then add specific content for the sub master page in the placeholder

<%@ Master Language="C#" MasterPageFile="~/Parent.master"%> 

Read up on it here nested master pages

skyfoot
This is all done by visual studio itself right? and I dont know about you guys, but for me MSDN is probably the worst place to read up on anything, they give all the information and yet none is understandable.
iamserious
but this nested master pages was i think the easiest of the lot since i understood what was on the page.
iamserious
You will need to define which masterpage the nested masterpage and the page use as you could have many different masterpages
skyfoot
+1  A: 

Hey,

Also, a nested master page shifts the content regions the content pages define, so you probably have to clean that up, pointing the content region placeholders to the new content regions instead of the old one (swap the ID's)...

That could be a source of the error too, hard to tell without seeing the source.

Brian
yea true, not much can be said without seeing the actual error, however, I deleted the designer file because this had solved many issues before for me, but when I right clicked and selected the option "Convert to web application" it says, "generation of designer file failed: Missing TagPrefix directive" - and I cant find anything obvious where that directive is missing...
iamserious
web applications use the designer file.... because it generates a class with all of the control definitions in it. So this would most likely be the issue. Could you delete and recreate the file, see if that solves the issue?
Brian
I did that already, finally found out that I was inheriting from a wrong class.. so I was barking up the wrong tree! the root of all misery (atleast for me yesterday) was a wrong parent class! but since I dint realize that and was asking this question, your answer seems to be perfect for this question, so will accept this. Thanks a lot though!
iamserious