开发者

What should I know before converting content pages to nested master-content pages in .net?

开发者 https://www.devze.com 2023-01-09 10:52 出处:网络
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.

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 a开发者_Go百科lready 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 didn't know where the NestedMasterPage's children content would go.

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

Thanks!

P.S: I didn't do this initially because I only had 2 pages, and I didn't need this at that time, as the project grew, now I see that I should have changed it much earlier.


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消