Reputation: 535
I'm creating an ASP.NET site where some pages need to have a div floated to the left with the site menu in and other pages don't have the menu div and instead the content takes up the entire page width.
I'm planning to use master pages - I was wondering how best to achieve this - a few immediate thoughts spring to mind:
It seems like this may be a common problem, so interested in how this is normally addressed. Note I am questioning the need for having pages without the menu - it would be simpler if all pages had exactly the same structure.
Upvotes: 0
Views: 661
Reputation: 2020
Nested master pages is probably the standard answer and should work well.
An alternative approach that occurs to me would be to put your menu in a panel control on the master page and expose a property that lets you toggle the visibility of the panel. I have not tried this yet, so I am not sure how practical it is, but it might be a fun concept to play with. If it works the way I expect this gives you a single master page that can be reconfigured by the content page.
Upvotes: 1
Reputation: 1250
At my previous company we used two separate master pages for a similar scenario. One that included the menu and one that did not. And because they both inherited the same base master page, they both had the same functionality.
But then again, I think it comes down to personal preference.
Personally, I like the idea of having two separate pages as that way it's a bit easier to see what's going on, compared to the nested master pages.
Upvotes: 0
Reputation: 524
Nested Master pages should solve your problem and also keep the Web Site scalable.
Upvotes: 0
Reputation: 2217
It's up to personal preferences, but the way I was recommended was to create nested master pages, the first master page would not contain the menu but the 2nd one would and then just point to one of the master pages.
Upvotes: 0