p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 2.0 Professional (http://p2p.wrox.com/forumdisplay.php?f=215)
-   -   Problem in nested master pages. (http://p2p.wrox.com/showthread.php?t=52296)

harsh.kintu January 5th, 2007 07:56 AM

Problem in nested master pages.

friends i am littlebit new in .net 2.0 and i have a problem.
please, help me.

i am using nested master pages in my project.
one is :
Front.master - > inner.master - > index.aspx
second is :
InnerFront.master - > inner.master - > aboutme.aspx

here, i have to call Page_PreInit method of inner.master, so it will select the master page according to requested URL.
if it is index.aspx then it will select Front.master
else it will select InnerFront.master.

i am unable to call PreInit method from Page(ex. : index.aspx)

Harsh Pandit
kintu designs

thenoseknows January 8th, 2007 07:39 PM

Well you wouldn't call pre_init, you would handle it if necessary by overriding it. It will always be called before the page loads on every iteration of the page life cycle. It will be called regardless of whether you handle it for yourself or "call it". At least thats my understanding of it. I think you should create a base page class that inherits from Page, handle the pre_init event in that, then inherit the base page class in every aspx page. Then in the pre_init handler you would check the request to see what page was requested and specify what master page to load dynamically. This blog post does a much better job of expaining it than I do:


Good luck.

harsh.kintu January 9th, 2007 10:04 AM

thanks a lot Neil.

All times are GMT -4. The time now is 04:00 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.